R/read_sol_gen_info.R

Defines functions read_sol_gen_info

read_sol_gen_info <- function(raw){

  gen_info <- as.data.frame(
    lapply(
      list(PEDON = substr(raw, 2, 11),
           SOURCE = substr(raw, 14, 24),
           TEXTURE = substr(raw, 26, 30),
           DEPTH = substr(raw, 32, 36),
           DESCRIPTION = substr(raw, 38, 87)),
      gsub,
      pattern = "(^  *)|(  *$)",
      replacement = "")
  )

  gen_info$DEPTH <- as.numeric(gen_info$DEPTH)

  return(gen_info)
}

Try the DSSAT package in your browser

Any scripts or data that you put into this service are public.

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