R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("lme4-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('lme4') Loading required package: Matrix Loading required package: lattice > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "formulas" > > ### * formulas > > flush(stderr()); flush(stdout()) > > ### Name: formulas > ### Title: Utilities for formulas > ### Aliases: getCovariate getCovariateFormula getGroups > ### getGroups,data.frame,formula-method getGroups,groupedData-method > ### getGroups,groupedData,missing-method getGroupsFormula > ### getGroupsFormula,ANY-method getResponse getResponseFormula subFormula > ### splitFormula > ### Keywords: models > > ### ** Examples > > form = resp ~ cov1 + cov2 | grp1/grp2 > getResponseFormula(form) ~resp > getCovariateFormula(form) ~cov1 + cov2 > getGroupsFormula(form) ~grp1/grp2 > getGroupsFormula(form, asList = TRUE) $grp1 ~grp1 $grp2 ~grp2 > > > > cleanEx(); ..nameEx <- "groupedData" > > ### * groupedData > > flush(stderr()); flush(stdout()) > > ### Name: groupedData > ### Title: Creation of groupedData objects > ### Aliases: groupedData convertFromS3groupedData > ### Keywords: manip > > ### ** Examples > > > > cleanEx(); ..nameEx <- "gsummary" > > ### * gsummary > > flush(stderr()); flush(stdout()) > > ### Name: gsummary > ### Title: Summarize a data frame by group > ### Aliases: gsummary gsummary-methods > ### gsummary,ANY,ANY,ANY,ANY,missing-method > ### gsummary,groupedData,ANY,ANY,ANY,factor-method > ### gsummary,data.frame,ANY,ANY,ANY,factor-method > ### Keywords: manip methods > > ### ** Examples > > ChickWeight <- do.call("data.frame", ChickWeight) > class(ChickWeight) [1] "data.frame" > gsummary(ChickWeight, groups = ChickWeight$Chick) weight Time Chick Diet 18 37.00000 1.00000 18 1 16 49.71429 6.00000 16 1 15 60.12500 7.00000 15 1 13 67.83333 10.91667 13 1 9 81.16667 10.91667 9 1 20 78.41667 10.91667 20 1 10 83.08333 10.91667 10 1 8 92.00000 10.00000 8 1 17 92.50000 10.91667 17 1 19 86.75000 10.91667 19 1 4 99.33333 10.91667 4 1 6 113.75000 10.91667 6 1 11 129.91667 10.91667 11 1 3 115.83333 10.91667 3 1 1 111.66667 10.91667 1 1 12 114.08333 10.91667 12 1 2 119.91667 10.91667 2 1 5 126.66667 10.91667 5 1 14 151.33333 10.91667 14 1 7 150.00000 10.91667 7 1 24 66.25000 10.91667 24 2 30 103.50000 10.91667 30 2 22 104.25000 10.91667 22 2 23 111.41667 10.91667 23 2 27 110.41667 10.91667 27 2 28 129.91667 10.91667 28 2 26 131.00000 10.91667 26 2 25 143.08333 10.91667 25 2 29 141.83333 10.91667 29 2 21 184.50000 10.91667 21 2 33 109.75000 10.91667 33 3 37 102.50000 10.91667 37 3 36 134.91667 10.91667 36 3 31 128.58333 10.91667 31 3 39 134.25000 10.91667 39 3 38 142.33333 10.91667 38 3 32 157.58333 10.91667 32 3 40 157.58333 10.91667 40 3 34 168.83333 10.91667 34 3 35 193.16667 10.91667 35 3 44 102.10000 9.00000 44 4 45 119.58333 10.91667 45 4 43 143.00000 10.91667 43 4 41 128.41667 10.91667 41 4 47 127.91667 10.91667 47 4 49 137.75000 10.91667 49 4 46 134.08333 10.91667 46 4 50 147.50000 10.91667 50 4 42 149.08333 10.91667 42 4 48 157.66667 10.91667 48 4 > gsummary(ChickWeight, groups = ChickWeight$Chick, + invariantsOnly = TRUE) Chick Diet 18 18 1 16 16 1 15 15 1 13 13 1 9 9 1 20 20 1 10 10 1 8 8 1 17 17 1 19 19 1 4 4 1 6 6 1 11 11 1 3 3 1 1 1 1 12 12 1 2 2 1 5 5 1 14 14 1 7 7 1 24 24 2 30 30 2 22 22 2 23 23 2 27 27 2 28 28 2 26 26 2 25 25 2 29 29 2 21 21 2 33 33 3 37 37 3 36 36 3 31 31 3 39 39 3 38 38 3 32 32 3 40 40 3 34 34 3 35 35 3 44 44 4 45 45 4 43 43 4 41 41 4 47 47 4 49 49 4 46 46 4 50 50 4 42 42 4 48 48 4 > > > > cleanEx(); ..nameEx <- "lmList" > > ### * lmList > > flush(stderr()); flush(stdout()) > > ### Name: lmList > ### Title: List of lm Objects with a Common Model > ### Aliases: lmList lmList,formula,data.frame-method > ### Keywords: models > > ### ** Examples > > (fm1 <- lmList(breaks ~ wool | tension, warpbreaks)) $L Call: lm(formula = formula, data = data) Coefficients: (Intercept) woolB 44.56 -16.33 $M Call: lm(formula = formula, data = data) Coefficients: (Intercept) woolB 24.000 4.778 $H Call: lm(formula = formula, data = data) Coefficients: (Intercept) woolB 24.556 -5.778 attr(,"call") lmList(formula = breaks ~ wool | tension, data = warpbreaks) attr(,"pool") [1] TRUE attr(,"class") [1] "lmList" attr(,"class")attr(,"package") [1] "lme4" > > > > cleanEx(); ..nameEx <- "pooledSD" > > ### * pooledSD > > flush(stderr()); flush(stdout()) > > ### Name: pooledSD > ### Title: Extract pooled standard deviation > ### Aliases: pooledSD > ### Keywords: models > > ### ** Examples > > pooledSD(lmList(weight ~ Time | Chick, do.call("data.frame", ChickWeight))) [1] 12.78833 attr(,"df") [1] 478 > > > > ### *