| twoLevelOpcreate {imageData} | R Documentation |
Creates a data.frame formed by applying, for each response, a binary operation to the paired values of two different treatments
Description
Takes pairs of values for a set of responses indexed by a two-level
treatment.factor and calculates, for each of pair,
the result of applying a binary operation to their values
for the two levels of the treatment.factor. The level of the
treatment.factor designated the control will be
on the right of the binary operator and the value for the other
level will be on the left.
Usage
twoLevelOpcreate(responses, data, treatment.factor = "Treatment.1",
suffices.treatment = c("Cont","Salt"), control = 1,
columns.suffixed = NULL,
operations = "/", suffices.results="OST",
columns.retained = c("Snapshot.ID.Tag","Smarthouse","Lane",
"Zones","xZones","SHZones","ZLane",
"ZMainplots","xMainPosn", "Genotype.ID"),
by = c("Smarthouse","Zones","ZMainplots"))
Arguments
responses |
A |
data |
A |
treatment.factor |
A |
suffices.treatment |
A |
control |
A |
columns.suffixed |
A |
operations |
A |
suffices.results |
A |
columns.retained |
A |
by |
A |
Value
A data.frame containing the following columns and the values of the :
those from
datanominated incolumns.retained;those containing the treated values of the columns whose names are specified in
responses; the treated values are those having the other level oftreatment.factorto that specified bycontrol;those containing the
controlvalues of the columns whose names are specified inresponses; the control values are those having the level oftreatment.factorspecified bycontrol;those containing the values calculated using the binary
operations; the names of these columns will be constructed fromresponsesby appendingsuffices.resultsto them.
Author(s)
Chris Brien
Examples
data(exampleData)
responses <- c("Area.smooth.AGR","Area.smooth.RGR")
cols.retained <- c("Snapshot.ID.Tag","Smarthouse","Lane","Position",
"Days","Snapshot.Time.Stamp", "Hour", "xDays",
"Zones","xZones","SHZones","ZLane","ZMainplots",
"xMainPosn", "Genotype.ID")
longi.SIIT.dat <-
twoLevelOpcreate(responses, longi.dat, suffices.treatment=c("C","S"),
operations = c("-", "/"),
suffices.results = c("diff", "SIIT"),
columns.retained = cols.retained,
by = c("Smarthouse","Zones","ZMainplots","Days"))
longi.SIIT.dat <- with(longi.SIIT.dat,
longi.SIIT.dat[order(Smarthouse,Zones,ZMainplots,Days),])