View source: R/convert_to_long_format.R
convert_to_long_format | R Documentation |
Reshapes FORCIS data by pivoting species columns into two columns: taxa
(taxon names) and counts
(taxon abundances). It converts wider data.frame
to a long format.
convert_to_long_format(data)
data |
a |
A data.frame
reshaped in a long format.
# 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)
# Reshape data ----
net_data <- convert_to_long_format(net_data)
# Dimensions of the data.frame ----
dim(net_data)
# Column names ----
colnames(net_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.