diff --git a/R/filter_by_bbox.R b/R/filter_by_bbox.R index 47160fa..ce86abc 100644 --- a/R/filter_by_bbox.R +++ b/R/filter_by_bbox.R @@ -1,9 +1,9 @@ #' Filter FORCIS data by a spatial bounding box #' #' @description -#' This function can be used to filter FORCIS data by a spatial bounding box. +#' Filters FORCIS data by a spatial bounding box. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset. +#' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param bbox an object of class `bbox` (package `sf`) or a vector of four #' `numeric` values defining a square bounding box. Values must follow this @@ -12,12 +12,35 @@ #' **Important:** if a vector of numeric values is provided, coordinates must #' be defined in the system WGS 84 (`epsg=4326`). #' -#' @return A `data.frame` containing a subset of `data`. +#' @return A `data.frame` containing a subset of `data` for the desired +#' bounding box. #' #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Attach the package ---- +#' library("forcis") +#' +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Get ocean names ---- +#' get_ocean_names() +#' +#' # Filter by oceans ---- +#' pump_data_sub <- filter_by_bbox(pump_data, bbox = c(35, 0, 45, 30)) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) filter_by_bbox <- function(data, bbox) { diff --git a/R/filter_by_month.R b/R/filter_by_month.R index 20575fe..a9aab5f 100644 --- a/R/filter_by_month.R +++ b/R/filter_by_month.R @@ -1,9 +1,9 @@ #' Filter FORCIS data by month of sampling #' #' @description -#' This function can be used to filter FORCIS data by month of sampling. +#' Filters FORCIS data by month of sampling. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset. +#' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param months a `numeric` containing one or several months. #' @@ -12,7 +12,26 @@ #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Attach the package ---- +#' library("forcis") +#' +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Filter by months ---- +#' pump_data_sub <- filter_by_month(pump_data, months = 1:2) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) filter_by_month <- function(data, months) { diff --git a/R/filter_by_ocean.R b/R/filter_by_ocean.R index f4a5980..7d41c48 100644 --- a/R/filter_by_ocean.R +++ b/R/filter_by_ocean.R @@ -1,19 +1,41 @@ #' Filter FORCIS data by ocean #' #' @description -#' This function can be used to filter FORCIS data by one or several oceans. +#' Filters FORCIS data by one or several oceans. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset. +#' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param ocean a `character` vector of one or several ocean names. Use the #' function `get_ocean_names()` to find the correct spelling. #' -#' @return A `data.frame` containing a subset of `data`. +#' @return A `data.frame` containing a subset of `data` for the desired oceans. #' #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Attach the package ---- +#' library("forcis") +#' +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Get ocean names ---- +#' get_ocean_names() +#' +#' # Filter by oceans ---- +#' pump_data_sub <- filter_by_ocean(pump_data, ocean = "Indian Ocean") +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) filter_by_ocean <- function(data, ocean) { diff --git a/R/filter_by_polygon.R b/R/filter_by_polygon.R index daa896b..44b2d8e 100644 --- a/R/filter_by_polygon.R +++ b/R/filter_by_polygon.R @@ -1,18 +1,44 @@ #' Filter FORCIS data by a spatial polygon #' #' @description -#' This function can be used to filter FORCIS data by a spatial polygon. +#' Filters FORCIS data by a spatial polygon. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset. +#' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param polygon an `sf POLYGON` object. #' -#' @return A `data.frame` containing a subset of `data`. +#' @return A `data.frame` containing a subset of `data` for the desired spatial +#' polygon. #' #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Attach the package ---- +#' library("forcis") +#' +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Import Indian Ocean spatial polygons ---- +#' file_name <- system.file(file.path("extdata", "IHO_Indian_ocean_polygon.gpkg"), +#' package = "forcis") +#' +#' indian_ocean <- sf::st_read(file_name) +#' +#' # Filter by polygon ---- +#' pump_data_sub <- filter_by_polygon(pump_data, polygon = indian_ocean) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) filter_by_polygon <- function(data, polygon) { diff --git a/R/filter_by_species.R b/R/filter_by_species.R index 9163fee..98c1e43 100644 --- a/R/filter_by_species.R +++ b/R/filter_by_species.R @@ -1,20 +1,58 @@ #' Filter FORCIS data by species #' #' @description -#' A short description... +#' Filters FORCIS data by a species list. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset, except for CPR North data. +#' @param data a `data.frame`. Must be the output of the function +#' `reshape_data()`, i.e. a FORCIS dataset in long format. #' #' @param species a `character` vector listing species of interest. #' -#' @param rm_na a `logical` value. If `FALSE`, keeps taxa with `NA` counts. +#' @param rm_na a `logical` value. If `FALSE` (default), keeps taxa with `NA` +#' counts. #' #' @return A `data.frame` containing a subset of `data`. #' #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Select a taxonomy ---- +#' pump_data <- select_taxonomy(pump_data, taxonomy = "OT") +#' +#' # Select only required columns (and taxa) ---- +#' pump_data <- select_columns(pump_data) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Convert data into long format ---- +#' pump_data <- reshape_data(pump_data) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Total number of species ---- +#' length(unique(pump_data$"taxa")) +#' +#' # Select records for three species ---- +#' pump_data_sub <- filter_by_species(data = pump_data, +#' species = c("g_inflata", "g_ruber", +#' "g_glutinata")) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) +#' +#' # Total number of species ---- +#' length(unique(pump_data_sub$"taxa")) filter_by_species <- function(data, species, rm_na = FALSE) { diff --git a/R/filter_by_year.R b/R/filter_by_year.R index 1f4e309..f2c42a4 100644 --- a/R/filter_by_year.R +++ b/R/filter_by_year.R @@ -1,9 +1,9 @@ #' Filter FORCIS data by year of sampling #' #' @description -#' This function can be used to filter FORCIS data by year of sampling. +#' Filters FORCIS data by year of sampling. #' -#' @param data a `data.frame`, i.e. a FORCIS dataset. +#' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param years a `numeric` containing one or several years. #' @@ -12,7 +12,26 @@ #' @export #' #' @examples -#' ## ADD EXAMPLE ---- +#' # Attach the package ---- +#' library("forcis") +#' +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Filter by years ---- +#' pump_data_sub <- filter_by_year(pump_data, years = 1985) +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data_sub) filter_by_year <- function(data, years) { diff --git a/R/select_columns.R b/R/select_columns.R index 42e1983..f76e2db 100644 --- a/R/select_columns.R +++ b/R/select_columns.R @@ -8,26 +8,40 @@ #' @param data a `data.frame`. One obtained by `read_*_data()` functions. #' #' @param cols a `character` vector of column names to keep in addition to the -#' required ones (see [get_required_columns()]) and to the taxa columns. +#' required ones (see [get_required_columns()]) and to the taxa columns. Can +#' be `NULL` (default). #' #' @export #' #' @return A `data.frame`. #' #' @examples -#' \dontrun{ -#' # Folder in which the database is stored ---- -#' path_to_db <- "data" +#' # Attach the package ---- +#' library("forcis") #' -#' # Download and read the plankton nets data ---- -#' nets <- forcis::read_plankton_nets_data(path_to_db) +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) #' #' # Select a taxonomy ---- -#' nets <- forcis::select_taxonomy(nets, taxonomy = "OT") +#' pump_data <- select_taxonomy(pump_data, taxonomy = "OT") +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) +#' +#' # Select only required columns (and taxa) ---- +#' pump_data <- select_columns(pump_data) #' -#' # Select required columns (and taxa) ---- -#' nets <- forcis::select_columns(nets) -#' } +#' # Dimensions of the data.frame ---- +#' dim(pump_data) select_columns <- function(data, cols = NULL) { diff --git a/R/select_taxonomy.R b/R/select_taxonomy.R index 4e4cb4b..02d3e29 100644 --- a/R/select_taxonomy.R +++ b/R/select_taxonomy.R @@ -15,16 +15,26 @@ #' @return A `data.frame`. #' #' @examples -#' \dontrun{ -#' # Folder in which the database is stored ---- -#' path_to_db <- "data" +#' # Attach the package ---- +#' library("forcis") #' -#' # Download and read the plankton nets data ---- -#' nets <- forcis::read_plankton_nets_data(path_to_db) +#' # Import example dataset ---- +#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), +#' package = "forcis") +#' +#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) +#' +#' # Add 'data_type' column ---- +#' pump_data$"data_type" <- "Pump" +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) #' #' # Select a taxonomy ---- -#' nets <- forcis::select_taxonomy(nets, taxonomy = "OT") -#' } +#' pump_data <- select_taxonomy(pump_data, taxonomy = "OT") +#' +#' # Dimensions of the data.frame ---- +#' dim(pump_data) select_taxonomy <- function(data, taxonomy) { diff --git a/man/filter_by_bbox.Rd b/man/filter_by_bbox.Rd index 2228942..1edb421 100644 --- a/man/filter_by_bbox.Rd +++ b/man/filter_by_bbox.Rd @@ -7,7 +7,7 @@ filter_by_bbox(data, bbox) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset.} +\item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{bbox}{an object of class \code{bbox} (package \code{sf}) or a vector of four \code{numeric} values defining a square bounding box. Values must follow this @@ -17,11 +17,34 @@ longitude (\code{xmax}), and maximum latitude (\code{ymax}). be defined in the system WGS 84 (\code{epsg=4326}).} } \value{ -A \code{data.frame} containing a subset of \code{data}. +A \code{data.frame} containing a subset of \code{data} for the desired +bounding box. } \description{ -This function can be used to filter FORCIS data by a spatial bounding box. +Filters FORCIS data by a spatial bounding box. } \examples{ -## ADD EXAMPLE ---- +# Attach the package ---- +library("forcis") + +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Get ocean names ---- +get_ocean_names() + +# Filter by oceans ---- +pump_data_sub <- filter_by_bbox(pump_data, bbox = c(35, 0, 45, 30)) + +# Dimensions of the data.frame ---- +dim(pump_data_sub) } diff --git a/man/filter_by_month.Rd b/man/filter_by_month.Rd index 96b8a26..9c027c9 100644 --- a/man/filter_by_month.Rd +++ b/man/filter_by_month.Rd @@ -7,7 +7,7 @@ filter_by_month(data, months) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset.} +\item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{months}{a \code{numeric} containing one or several months.} } @@ -15,8 +15,27 @@ filter_by_month(data, months) A \code{data.frame} containing a subset of \code{data} for the desired months. } \description{ -This function can be used to filter FORCIS data by month of sampling. +Filters FORCIS data by month of sampling. } \examples{ -## ADD EXAMPLE ---- +# Attach the package ---- +library("forcis") + +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Filter by months ---- +pump_data_sub <- filter_by_month(pump_data, months = 1:2) + +# Dimensions of the data.frame ---- +dim(pump_data_sub) } diff --git a/man/filter_by_ocean.Rd b/man/filter_by_ocean.Rd index 0c88b6d..c00938b 100644 --- a/man/filter_by_ocean.Rd +++ b/man/filter_by_ocean.Rd @@ -7,17 +7,39 @@ filter_by_ocean(data, ocean) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset.} +\item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{ocean}{a \code{character} vector of one or several ocean names. Use the function \code{get_ocean_names()} to find the correct spelling.} } \value{ -A \code{data.frame} containing a subset of \code{data}. +A \code{data.frame} containing a subset of \code{data} for the desired oceans. } \description{ -This function can be used to filter FORCIS data by one or several oceans. +Filters FORCIS data by one or several oceans. } \examples{ -## ADD EXAMPLE ---- +# Attach the package ---- +library("forcis") + +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Get ocean names ---- +get_ocean_names() + +# Filter by oceans ---- +pump_data_sub <- filter_by_ocean(pump_data, ocean = "Indian Ocean") + +# Dimensions of the data.frame ---- +dim(pump_data_sub) } diff --git a/man/filter_by_polygon.Rd b/man/filter_by_polygon.Rd index 21be3cb..d305fe3 100644 --- a/man/filter_by_polygon.Rd +++ b/man/filter_by_polygon.Rd @@ -7,16 +7,42 @@ filter_by_polygon(data, polygon) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset.} +\item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{polygon}{an \verb{sf POLYGON} object.} } \value{ -A \code{data.frame} containing a subset of \code{data}. +A \code{data.frame} containing a subset of \code{data} for the desired spatial +polygon. } \description{ -This function can be used to filter FORCIS data by a spatial polygon. +Filters FORCIS data by a spatial polygon. } \examples{ -## ADD EXAMPLE ---- +# Attach the package ---- +library("forcis") + +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Import Indian Ocean spatial polygons ---- +file_name <- system.file(file.path("extdata", "IHO_Indian_ocean_polygon.gpkg"), + package = "forcis") + +indian_ocean <- sf::st_read(file_name) + +# Filter by polygon ---- +pump_data_sub <- filter_by_polygon(pump_data, polygon = indian_ocean) + +# Dimensions of the data.frame ---- +dim(pump_data_sub) } diff --git a/man/filter_by_species.Rd b/man/filter_by_species.Rd index 13404b3..9b6a5fb 100644 --- a/man/filter_by_species.Rd +++ b/man/filter_by_species.Rd @@ -7,18 +7,56 @@ filter_by_species(data, species, rm_na = FALSE) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset, except for CPR North data.} +\item{data}{a \code{data.frame}. Must be the output of the function +\code{reshape_data()}, i.e. a FORCIS dataset in long format.} \item{species}{a \code{character} vector listing species of interest.} -\item{rm_na}{a \code{logical} value. If \code{FALSE}, keeps taxa with \code{NA} counts.} +\item{rm_na}{a \code{logical} value. If \code{FALSE} (default), keeps taxa with \code{NA} +counts.} } \value{ A \code{data.frame} containing a subset of \code{data}. } \description{ -A short description... +Filters FORCIS data by a species list. } \examples{ -## ADD EXAMPLE ---- +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Select a taxonomy ---- +pump_data <- select_taxonomy(pump_data, taxonomy = "OT") + +# Select only required columns (and taxa) ---- +pump_data <- select_columns(pump_data) + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Convert data into long format ---- +pump_data <- reshape_data(pump_data) + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Total number of species ---- +length(unique(pump_data$"taxa")) + +# Select records for three species ---- +pump_data_sub <- filter_by_species(data = pump_data, + species = c("g_inflata", "g_ruber", + "g_glutinata")) + +# Dimensions of the data.frame ---- +dim(pump_data_sub) + +# Total number of species ---- +length(unique(pump_data_sub$"taxa")) } diff --git a/man/filter_by_year.Rd b/man/filter_by_year.Rd index 1c03687..a942364 100644 --- a/man/filter_by_year.Rd +++ b/man/filter_by_year.Rd @@ -7,7 +7,7 @@ filter_by_year(data, years) } \arguments{ -\item{data}{a \code{data.frame}, i.e. a FORCIS dataset.} +\item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{years}{a \code{numeric} containing one or several years.} } @@ -15,8 +15,27 @@ filter_by_year(data, years) A \code{data.frame} containing a subset of \code{data} for the desired years. } \description{ -This function can be used to filter FORCIS data by year of sampling. +Filters FORCIS data by year of sampling. } \examples{ -## ADD EXAMPLE ---- +# Attach the package ---- +library("forcis") + +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) + +# Filter by years ---- +pump_data_sub <- filter_by_year(pump_data, years = 1985) + +# Dimensions of the data.frame ---- +dim(pump_data_sub) } diff --git a/man/select_columns.Rd b/man/select_columns.Rd index 550bc73..08d9b85 100644 --- a/man/select_columns.Rd +++ b/man/select_columns.Rd @@ -10,7 +10,8 @@ select_columns(data, cols = NULL) \item{data}{a \code{data.frame}. One obtained by \verb{read_*_data()} functions.} \item{cols}{a \code{character} vector of column names to keep in addition to the -required ones (see \code{\link[=get_required_columns]{get_required_columns()}}) and to the taxa columns.} +required ones (see \code{\link[=get_required_columns]{get_required_columns()}}) and to the taxa columns. Can +be \code{NULL} (default).} } \value{ A \code{data.frame}. @@ -21,17 +22,30 @@ columns, this function can be used to lighten the \code{data.frame} to easily handle it and to speed up some computations. } \examples{ -\dontrun{ -# Folder in which the database is stored ---- -path_to_db <- "data" +# Attach the package ---- +library("forcis") -# Download and read the plankton nets data ---- -nets <- forcis::read_plankton_nets_data(path_to_db) +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) # Select a taxonomy ---- -nets <- forcis::select_taxonomy(nets, taxonomy = "OT") +pump_data <- select_taxonomy(pump_data, taxonomy = "OT") -# Select required columns (and taxa) ---- -nets <- forcis::select_columns(nets) -} +# Dimensions of the data.frame ---- +dim(pump_data) + +# Select only required columns (and taxa) ---- +pump_data <- select_columns(pump_data) + +# Dimensions of the data.frame ---- +dim(pump_data) } diff --git a/man/select_taxonomy.Rd b/man/select_taxonomy.Rd index f6be8da..b9a8fa8 100644 --- a/man/select_taxonomy.Rd +++ b/man/select_taxonomy.Rd @@ -21,14 +21,24 @@ taxonomies: \code{"LT"} (lumped taxonomy), \code{"VT"} (validated taxonomy) and further information. } \examples{ -\dontrun{ -# Folder in which the database is stored ---- -path_to_db <- "data" +# Attach the package ---- +library("forcis") -# Download and read the plankton nets data ---- -nets <- forcis::read_plankton_nets_data(path_to_db) +# Import example dataset ---- +file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"), + package = "forcis") + +pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE) + +# Add 'data_type' column ---- +pump_data$"data_type" <- "Pump" + +# Dimensions of the data.frame ---- +dim(pump_data) # Select a taxonomy ---- -nets <- forcis::select_taxonomy(nets, taxonomy = "OT") -} +pump_data <- select_taxonomy(pump_data, taxonomy = "OT") + +# Dimensions of the data.frame ---- +dim(pump_data) }