rvn_write_Raven_table: Writes a nicely formatted tables of Raven...

View source: R/rvn_write_Raven_table.R

rvn_write_Raven_tableR Documentation

Writes a nicely formatted tables of Raven attributes/parameters

Description

Writes a nicely formatted tables of Raven attributes/parameters

Usage

rvn_write_Raven_table(
  attributes,
  units,
  df,
  filename,
  id_col = TRUE,
  justify = "right",
  sep = ", ",
  ...
)

Arguments

attributes

array of strings containing attribute/parameter names

units

array of strings with the corresponding units

df

Dataframe of values corresponding to attributes/parameters

filename

Name of the file, with extension, to append the table to

id_col

TRUE/FALSE of whether an numeric id column is the first column in the table and, in common Raven fashion, does not have a corresponding attribute (default TRUE)

justify

alignment of character columns (default 'right'). See format

sep

character(s) used to seperate columns (default ', ')

...

Extra arguments for write.fwf

Value

TRUE

returns TRUE if executed successfully

Author(s)

Leland Scantlebury, leland@scantle.com

Examples

soil_classes <- data.frame('Attributes' = c('DEFAULT','ALTERNATIVE'),
                           'SAND'      = c(0.4316, 0.3000),
                           'CLAY'      = c(0.1684, 0.4000),
                           'SILT'      = c(0.4000, 0.3000),
                           'ORGANIC'   = c(0.0000, 0.0000))
attributes <- c('%SAND','%CLAY','%SILT','%ORGANIC')
units <-  rep('none',4)

tf <- file.path(tempdir(), "Hogwarts.rvp")
rvn_write_Raven_table(tf, attributes = attributes, units = units, df = soil_classes)

# view file
readLines(tf)


rchlumsk/RavenR documentation built on April 19, 2024, 5:15 a.m.