read_tier_data: Reads data from a single tier of a DSSAT output file

View source: R/read_tier_data.R

read_tier_dataR Documentation

Reads data from a single tier of a DSSAT output file

Description

Reads data from a single tier of a DSSAT output file

Usage

read_tier_data(
  raw_lines,
  col_types = NULL,
  col_names = NULL,
  na_strings = NULL,
  left_justified = "EXCODE",
  guess_max = 1000,
  join_tiers = TRUE,
  store_v_fmt = TRUE,
  read_only = NULL,
  tier_fmt = NULL,
  convert_date_cols = TRUE
)

Arguments

raw_lines

a character vector that includes the contents of a single tier of data (including headline, but excluding version stamp and other header information) from a DSSAT output file

col_types

One of NULL, a cols() specification, or a string. See read_fwf or vignette("readr") for more details.

col_names

A character vector of column names; primarily helpful for cases where there are no white spaces between column names within the header line

na_strings

a character vector of string to represent missing values

left_justified

A character vector of column names that should be left justified

guess_max

An integer indicating the maximum number of lines that should be used to guess the type of a column

join_tiers

A logical indicating whether the multiple tiers should be combined into a single tibble

store_v_fmt

a logical value indicating whether or not to store the format for variables being read

read_only

NULL or a character vector of column names that should be read in; If non-NULL only the columns listed will be read in.

convert_date_cols

A logical value indicating whether to convert columns expected to be dates into date-time format. If TRUE, any column that matches the following regular expression will be converted: "(DATE)|((?<!(L)|(SS))AT$)|(PFRST)|(PLAST)|(HFRST)|(HLAST)"

Value

a tibble or list of tibbles containing the data from the raw DSSAT output

Examples


sample_data_tier <- c(
"@YEAR DOY   DAS   SRAA    ES1D    ES2D    ES3D    ES4D    ES5D    ES6D    ES7D    ES8D",
" 2006 001     1   7.40   0.508   0.175   0.060   0.101   0.083   0.110   0.098   0.035",
" 2006 002     2   8.40   0.849   0.263   0.064   0.104   0.086   0.113   0.101   0.036",
" 2006 003     3  13.10   1.148   0.549   0.091   0.132   0.108   0.144   0.128   0.046")

read_tier_data(sample_data_tier)

DSSAT documentation built on Nov. 9, 2023, 1:08 a.m.