RAM.factors: Factor Formatting for RAM

Description Details

Description

This help page details how to pass metadata arguments in RAM.

Details

Many functions will expect arguments such as meta and factors (possibly row.factor or col.factor). These functions are expecting the full metadata table for meta (which you probably read into R using read.meta). The other argument, factor, should be a named character vector. The values of this vector should be the columns to be used from meta, while the names of the vector should be the labels you wish to have displayed in the plots. There are several ways to name a character vector: \Sexpr[echo=TRUE, results=verbatim]{ my.vec <- c(This="is", a="named", character="vector")} \Sexpr[echo=TRUE, results=verbatim]{names(my.vec)} \Sexpr[echo=TRUE, results=verbatim]{cat(my.vec)} Notice that myvec has names "This", "a", "character", but has values "is", "named", "vector". It is the names that will be used to label graphs in RAM, but the values that will be used to extract the actual data. This is useful if you have more complicated names; say we want the data from the column named "Precip_14d_before_harvest", but we want a nicer label for the plot. We can do the following: \Sexpr[echo=TRUE, results=verbatim]{ my.vec <- "Precip_14d_before_harvest"} \Sexpr[echo=TRUE, results=verbatim]{ names(my.vec) <- "Precipitation (14 d. prior to Harvest, mm)"} Now we will be able to plot the value of the "Precip_14d_before_harvest" column, but we will have the (much nicer!) label "Precipitation (14 d. prior to Harvest, mm)" appear in our plots.


RAM documentation built on May 2, 2019, 3:04 p.m.