Selects columns in FORCIS data. Because FORCIS data contains more than 100
columns, this function can be used to lighten the data.frame
to easily
handle it and to speed up some computations.
Arguments
- data
a
data.frame
. One obtained byread_*_data()
functions.- cols
a
character
vector of column names to keep in addition to the required ones (seeget_required_columns()
) and to the taxa columns. Can beNULL
(default).
Examples
# Attach the package ----
library("forcis")
# 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"
# Dimensions of the data.frame ----
dim(net_data)
#> [1] 2451 77
# Select a taxonomy ----
net_data <- select_taxonomy(net_data, taxonomy = "VT")
# Dimensions of the data.frame ----
dim(net_data)
#> [1] 2451 77
# Select only required columns (and taxa) ----
net_data <- select_forcis_columns(net_data)
# Dimensions of the data.frame ----
dim(net_data)
#> [1] 2451 77