twoLevelOpcreate | R Documentation |
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.
twoLevelOpcreate(data, responses, 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",
"Zone","cZone","SHZone","ZLane",
"ZMainunit","cMainPosn", "Genotype.ID"),
by = c("Smarthouse","Zone","ZMainunit"))
data |
A |
responses |
A |
treatment.factor |
A |
suffices.treatment |
A |
control |
A |
columns.suffixed |
A |
operations |
A |
suffices.results |
A |
columns.retained |
A |
by |
A |
A data.frame
containing the following columns and the values of the :
those from data
nominated in columns.retained
;
those containing the treated values of the columns whose names
are specified in responses
; the treated values are
those having the other level of treatment.factor
to
that specified by control
;
those containing the control
values of the columns whose
names are specified in responses
; the control values are
those having the level of treatment.factor
specified
by control
;
those containing the values calculated using the binary
operations
; the names of these columns will be
constructed from responses
by appending
suffices.results
to them.
Chris Brien
data(exampleData)
responses <- c("sPSA.AGR","sPSA.RGR")
cols.retained <- c("Snapshot.ID.Tag","Smarthouse","Lane","Position",
"DAP","Snapshot.Time.Stamp", "Hour", "xDAP",
"Zone","cZone","SHZone","ZLane","ZMainunit",
"cMainPosn", "Genotype.ID")
longi.SIIT.dat <-
twoLevelOpcreate(data = longi.dat, responses = responses,
suffices.treatment=c("C","S"),
operations = c("-", "/"),
suffices.results = c("diff", "SIIT"),
columns.retained = cols.retained,
by = c("Smarthouse","Zone","ZMainunit","DAP"))
longi.SIIT.dat <- with(longi.SIIT.dat,
longi.SIIT.dat[order(Smarthouse,Zone,ZMainunit,DAP),])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.