Write *.100 input files for Century
write_100.Rdwrite_100 allows users to create input files (extension '.100') for the CENTURY soil model.
Usage
write_100(
x,
pathname = pathname,
filename = filename,
ndigits = 6,
sep = " ",
overwrite = FALSE
)Arguments
- x
listwith as many elements as events as needed. Each event starts with a short label and a long title.- pathname
characterstring with valid path to a folder.- filename
characterstring specifying the name of the file with its extension.- ndigits
integerspecifying the number of digits to print for numeric values.- sep
the field separator string. Values within each row of x are separated by this string.
- overwrite
logical, if set to FALSE (default), the code will stop if file already exists. If set to TRUE, the previous file will be overwritten.
Details
At this stage there are almost no checks as to whether fields are correctly specified. That's left as a researcher's task.
Examples
# Example list with two elements.
x <- list()
df <- data.frame(runif(11), c(paste0("cultra(", 1:7, ")"), paste0("clteff(", 1:4, ")")))
colnames(df) <- NULL
x[[1]] <- list(label = "E1", title = "Example1", df = df)
df <- data.frame(runif(11), c(paste0("cultra(", 1:7, ")"), paste0("clteff(", 1:4, ")")))
colnames(df) <- NULL
x[[2]] <- list(label = "E1", title = "Example1", df = df)
# Create temporary path.
path <- tempdir()
write_100(x, path, "cult.100")