Learn R Programming

atlantistools (version 0.4.3)

preprocess_txt: Preprocess dataframes loaded in with load_txt()

Description

sep_col is split into multiple columns given by into. If column ageclass is present and values start with 0 one is added to align with agestructure in other functions. Columns without any informations (length(unique()) == 1) are dropped. If the first time step only has zeros as values remove these values. remove zeros overall!

Usage

preprocess_txt(df_txt, sep_col = "code", into)

Arguments

df_txt

Dataframe read in with load_txt().

sep_col

Column to separate into multiple columns. Default is "code".

into

Character vector given the columns to split sep_col in.

Value

Tidy dataframe.

Examples

Run this code
# NOT RUN {
d <- system.file("extdata", "setas-model-new-becdev", package = "atlantistools")
df <- load_txt(file = file.path(d, "outputSETASSpecificPredMort.txt"))
df <- preprocess_txt(df_txt = df, into = c("pred", "agecl", "empty_col1", "prey", "empty_col2"))
head(df)

df <- load_txt(file = file.path(d, "outputSETASSpecificMort.txt"))
df <- preprocess_txt(df_txt = df, into = c("species", "agecl", "empty_col", "mort"))
head(df)
# }

Run the code above in your browser using DataLab