seWithin | R Documentation |
seWithin is used to compute the standard error(s) for one or more variables, for one or more groups in a dataframe, handling within-subjects variables by removing inter-subject variability
seWithin(data = NULL, measurevar, betweenvars = NULL, withinvars = NULL, idvar = NULL, na.rm = TRUE, conf.interval = 0.95, shownormed = FALSE)
data |
a dataframe |
measurevar |
the name(s) of column(s) that contain the variable to be summariezed |
betweenvars |
a vector containing names of columns that are between-subjects variables |
withinvars |
a vector containing names of columns that are within-subjects variables |
idvar |
the name of the column that identifies each subject |
na.rm |
boolean that indicates whether to ignore NA's |
conf.interval |
confidence interval range |
shownormed |
whether to show noramlized results |
A data.table
Code adapted from R cookbook (see references).
Hause Lin
http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/
stderror
stderror
result <- seWithin(data = ChickWeight, measurevar = "weight", betweenvars = "Diet", withinvars = "Time", idvar = "Chick") # multiple outcome variables ChickWeight2 <- ChickWeight ChickWeight2$weight2 <- ChickWeight2$weight * 100 # create a new outcome variable result <- seWithin(data = ChickWeight2, measurevar = c("weight", "weight2"), betweenvars = "Diet", withinvars = "Time", idvar = "Chick")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.