filter_by_species: Filter FORCIS data by species

View source: R/filter_by_species.R

filter_by_speciesR Documentation

Filter FORCIS data by species

Description

Filters FORCIS data by a species list.

Usage

filter_by_species(data, species)

Arguments

data

a data.frame. One obtained by ⁠read_*_data()⁠ functions.

species

a character vector listing species of interest.

Value

A data.frame containing a subset of data.

Examples

# Import example dataset ----
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), 
                         package = "forcis")

net_data <- read.table(file_name, dec = ".", sep = ";")

# Add 'data_type' column ----
net_data$"data_type" <- "Net"

# Select a taxonomy ----
net_data <- select_taxonomy(net_data, taxonomy = "VT")

# Select only required columns (and taxa) ----
net_data <- select_forcis_columns(net_data)

# Dimensions of the data.frame ----
dim(net_data)

# Get species names ----
get_species_names(net_data)

# Select records for three species ----
net_data_sub <- filter_by_species(data    = net_data, 
                                  species = c("g_inflata_VT", 
                                              "g_elongatus_VT", 
                                              "g_glutinata_VT"))

# Dimensions of the data.frame ----
dim(net_data_sub)

# Get species names ----
get_species_names(net_data_sub)

FRBCesab/forcis documentation built on Oct. 25, 2024, 9:26 a.m.