select_forcis_columns: Select columns in FORCIS data

View source: R/select_forcis_columns.R

select_forcis_columnsR Documentation

Select columns in FORCIS data

Description

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.

Usage

select_forcis_columns(data, cols = NULL)

Arguments

data

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

cols

a character vector of column names to keep in addition to the required ones (see get_required_columns()) and to the taxa columns. Can be NULL (default).

Value

A data.frame.

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)

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

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

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

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

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