Description Usage Arguments Details Value Examples
Add rows to a data frame for all combinations of the recorded effort variables and the recorded group variables.
1 |
df |
A data frame containing the effort, group, and measurement variables. See details. |
effvars |
A character vector with the names of the effort variables, typically identifying the design space and/or time. |
grpvars |
A character vector with the names of the group variables, typically identifying the categories of things measured. |
measvars |
A character vector with the names of the measurement variables. |
fillwith |
A scalar, assigned to the measurement variables for the added rows. |
The need for this function arises when measurements are recorded only for the subset of possible grouping observed. For example, when surveying trees, measurements for oak and maple may be recorded for a given plot, while the "missing" measurements for many other species of interest are not recorded.
Additional variables may also be included in df
. These will be
carried through to the returned data frame, and will have missing values
for any rows added by the function.
Note that only the observed combinations of the effort variables and only the observed combinations of the group variables are used to determine missing effort-group combinations. In other words, if only large oaks and small hickories are observed, then no rows are added for small oaks or large hickories. See example.
A data frame containing the same variables as df
with additional
rows for any combinations of effort and group excluded from df
.
See details.
1 2 3 4 5 6 7 8 9 | mydat <- data.frame(
year = c(1990, 1991, 1991, 1992, 1992),
plot = c(1, 1, 2, 1, 2),
tree = c("oak", "oak", "maple", "maple", "hickory"),
size = c("large", "large", "small", "large", "small"),
number = c(3, 4, 5, 8, 4),
condition = c(6, 8, 5, 16, 4))
fill0(df=mydat, effvars=c("year", "plot"), grpvars=c("tree", "size"),
measvars="number")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.