Title: | The Fisheries Scientist's Toolbox |
---|---|
Description: | A bundle of analytics tools for fisheries scientists. A 'shiny' R App is included for a 'no-code' solution for retrieval, analysis, and visualization. |
Authors: | Pasquale Buonomo [cre, aut] |
Maintainer: | Pasquale Buonomo <[email protected]> |
License: | AGPL (>= 3) |
Version: | 1.2.3 |
Built: | 2025-01-21 04:25:41 UTC |
Source: | https://github.com/shyentist/fish-r-man |
Function to check the type of dataframe in relation to fishRman. Most of the times the user will not call this function directly, but it can be useful for debug.
df.type(df)
df.type(df)
df |
The dataframe to check. |
A string explaining how the input dataframe is treated by fishRman.
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) what.type <- df.type(df) print(what.type) # "GFW Fishing Effort By Vessel"
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) what.type <- df.type(df) print(what.type) # "GFW Fishing Effort By Vessel"
Wrapper function for 'dplyr::summarise()' that summarizes GFW data into the most important measures of central tendency for fishing_hours and hours, creating a new dataframe. It will have one (or more) rows for each combination of grouping variables; if there are no grouping variables, the output will have a single row summarising all observations in the input.
gfw.summarize(df)
gfw.summarize(df)
df |
A dataframe object as downloaded from GFW's Google Big Data Query. |
A dataframe.
[dplyr::summarise()] [dplyr::group_by()]
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) summary <- gfw.summarize(df) print(summary)
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) summary <- gfw.summarize(df) print(summary)
Run the Shiny Application
run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... )
run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... )
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
uiPattern |
A regular expression that will be applied to each |
... |
arguments to pass to golem_opts. See '?golem::get_golem_options' for more details. |
Does not return a value. This function launches the embedded Shiny application, making it accessible through a web browser. The user interacts with the Shiny app through the browser interface.
Function that sorts a dataframe in descending order for a specific column, calculates the sum of all rows for that column, applies the chosen percentage to said sum, and subsets the minimum number of consecutive rows needed to reach this value.
top.percent.by(df, percentage, by)
top.percent.by(df, percentage, by)
df |
A dataframe object as downloaded from GFW's Google Big Data Query. |
percentage |
Number. The 'x' in 'the top x percent of the dataframe'. |
by |
Character. The name of the column for which the percentage will be calculated. |
A dataframe.
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) who.fishs.the.most <- top.percent.by(df, 90, "fishing_hours") print(who.fishs.the.most)
dated <- c("2020-01-01", "2020-01-02") lat <- c(40, 41) lon <- c(12,13) mmsi <- c("34534555", "25634555") hours <- c(0, 5) fishing_hours <- c(1,9) df <- data.frame(dated, lat, lon, mmsi, hours, fishing_hours) who.fishs.the.most <- top.percent.by(df, 90, "fishing_hours") print(who.fishs.the.most)