Description Usage Arguments Value Author(s) Examples
View source: R/plot_by_component.R
Constructs a bar chart of a provided response variable for all treatments containing a specified component within a trial. Exports graph to pdf only. Exports data used to generate graph to tab separated file.
1 2 3 4 5 | plot_by_component(datafile,
treatment_list,
component,
trial = "",
resp_var = "DATA")
|
datafile |
A dataframe containing the column specified as resp_var and 'SUMMARY TRT#', and 'TRIAL #'. This dataframe is contained within the output of the 'readallsheets' function. |
treatment_list |
A dataframe containing the columns 'TREATMENT COMPONENT', one of which corresponding to component, and 'SUMMARY TRT #'. This dataframe is contained within the output of 'readallsheets' function. |
component |
A character string corresponding to at least one entry within the treatment_list column 'TREATMENT COMPONENT'. |
trial |
A character string corresponding to an entry within the 'TRIAL #' column of dataframe. Optional, as not specifying a value will result in the first trial being used. |
resp_var |
A character string corresponding to the column header present within dataframe, which contains numeric data. |
returns an aggregated datafile subsetted to treatments which contain the specified component, aggregating multiple instances of a given treatment.
Brent Murphy
1 2 3 4 5 6 7 8 9 10 11 12 13 | trtlist <- data.frame("SUMMARY TRT #"=c("1-A","1-B",
"2-A","2-B","3-A"),
"TREATMENT COMPONENT" = c("a","b","a",
"c","b"))
names(trtlist) <- c("SUMMARY TRT #","TREATMENT COMPONENT")
datafile <- data.frame("DATA" = c(10,9,8,7,6,5,4),
"SUMMMARY TRT#" = c(1,2,3,4,5,1,1),
"TRIAL #" = c(1,1,1,1,1,1,2))
names(datafile) <- c("DATA","SUMMARY TRT#","TRIAL #")
plot_by_component(datafile = datafile,
treatment_list = trtlist,
component = "a",
resp_var = "DATA")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.