Learn R Programming

RavenR (version 2.2.0)

rvn_write_Raven_table: 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 = ", ",
  ...
)

Value

TRUE

returns TRUE if executed successfully

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

Author

Leland Scantlebury, leland@scantle.com

Examples

Run this code
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)

Run the code above in your browser using DataLab