preprocess_txt: Preprocess dataframes loaded in with 'load_txt()'

Description Usage Arguments Value Examples

View source: R/preprocess-txt.R

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

1
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

1
2
3
4
5
6
7
8
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)

atlantistools documentation built on Aug. 16, 2017, 9:05 a.m.