From 605a12bb33a9ee3ef313a26c4db97dd7efd6d4c2 Mon Sep 17 00:00:00 2001
From: Walmes Zeviani <walmeszeviani@gmail.com>
Date: Sun, 20 Sep 2015 11:52:29 -0300
Subject: [PATCH] Add dataset of a 2^2 RBD experiment, Pimentel pg 120.

---
 R/legTools.R          |  69 ++++++++++++++++++++++++++++++++++++++++--
 data-raw/filterCake.R |  49 ++++++++++++++++++++++++++++++
 data/filterCake.RData | Bin 0 -> 282 bytes
 man/filterCake.Rd     |  62 +++++++++++++++++++++++++++++++++++++
 man/vinasseFert.Rd    |   5 +--
 5 files changed, 181 insertions(+), 4 deletions(-)
 create mode 100644 data-raw/filterCake.R
 create mode 100644 data/filterCake.RData
 create mode 100644 man/filterCake.Rd

diff --git a/R/legTools.R b/R/legTools.R
index 963ddcc..a315161 100644
--- a/R/legTools.R
+++ b/R/legTools.R
@@ -579,8 +579,9 @@ NULL
 #' @title Fertilization with vinasse and mineral
 #'
 #' @description These data are from an \eqn{2^2} factorial experiment
-#'     studing the effect of fertilizaton with vinasse (organic font)
-#'     and complete mineral fertilization.
+#'     studing the effect of fertilizaton with vinasse (a residual from
+#'     industrial processing of sugar cane) and complete mineral
+#'     fertilization.
 #'
 #' \itemize{
 #'   \item \code{block} a factor with 4 levels.
@@ -630,3 +631,67 @@ NULL
 #' summary(m1)
 #'
 NULL
+
+#' @name filterCake
+#'
+#' @title Fertilization with filter cake and mineral
+#'
+#' @description These data are from an \eqn{2^2} factorial experiment
+#'     studing the effect of fertilizaton with filter cake (a residual
+#'     from industrial processing of sugar cane) and traditional mineral
+#'     fertilization.
+#'
+#' \itemize{
+#'   \item \code{block} a factor with 4 levels.
+#'   \item \code{mineral} low (-1) and high (+1) levels of mineral
+#'     fertilization.
+#'   \item \code{cake} low (-1) and high (+1) levels of fetilization
+#'     with filter cake.
+#'   \item \code{y} some response variable. The text book doesn't give
+#'     any information.
+#' }
+#'
+#' @docType data
+#'
+#' @keywords datasets
+#'
+#' @usage data(filterCake)
+#'
+#' @format a \code{data.frame} with 16 records and 4 variables.
+#'
+#' @source Frederico, P. (2009). Curso de Estatística Experimental (15th
+#'     ed.). Piracicaba, São Paulo: FEALQ. (page 120)
+#'
+#' @examples
+#'
+#' library(lattice)
+#' library(latticeExtra)
+#'
+#' data(filterCake)
+#' str(filterCake)
+#'
+#' xyplot(y~cake, groups=mineral,
+#'        auto.key=list(title="Mineral", columns=2),
+#'        data=filterCake, type=c("p", "a"),
+#'        ylab="y",
+#'        xlab="Filter cake level")
+#'
+#' m0 <- lm(y~block+(cake+mineral)^2, data=filterCake)
+#' par(mfrow=c(2,2)); plot(m0); layout(1)
+#' anova(m0)
+#'
+#' summary(m0)
+#'
+#' filterCake$Mineral <- factor(filterCake$mineral,
+#'                              labels=c("absent", "present"))
+#'
+#' m1 <- aov(y~block+Mineral/cake, data=filterCake)
+#' anova(m1)
+#'
+#' ## Split SS to see effect of cake in each level of mineral.
+#' summary(m1, split=list("Mineral:cake"=list("absent"=1, "present"=2)))
+#'
+#' summary.lm(m1)
+#'
+#'
+NULL
diff --git a/data-raw/filterCake.R b/data-raw/filterCake.R
new file mode 100644
index 0000000..52aa6d3
--- /dev/null
+++ b/data-raw/filterCake.R
@@ -0,0 +1,49 @@
+##----------------------------------------------------------------------
+## Data generation.
+
+filterCake <- expand.grid(block=gl(4, 1), mineral=c(-1, 1),
+                          cake=c(-1, 1), KEEP.OUT.ATTRS=FALSE)
+
+filterCake$y <- c(18.0, 8.6, 9.4, 11.4, 20.6, 21.0, 18.6, 20.6, 19.6,
+                  15.0, 14.6, 15.8, 19.2, 19.6, 18.4, 20.2)
+
+str(filterCake)
+
+save(filterCake, file="../data/filterCake.RData")
+
+##----------------------------------------------------------------------
+## Examples.
+
+library(lattice)
+library(latticeExtra)
+
+data(filterCake)
+str(filterCake)
+
+xyplot(y~cake, groups=mineral,
+       auto.key=list(title="Mineral", columns=2),
+       data=filterCake, type=c("p", "a"),
+       ylab="y",
+       xlab="Filter cake level")
+
+m0 <- lm(y~block+(cake+mineral)^2, data=filterCake)
+par(mfrow=c(2,2)); plot(m0); layout(1)
+anova(m0)
+
+summary(m0)
+
+filterCake$Mineral <- factor(filterCake$mineral,
+                             labels=c("absent", "present"))
+
+m1 <- aov(y~block+Mineral/cake, data=filterCake)
+anova(m1)
+
+## Split SS to see effect of cake in each level of mineral.
+summary(m1, split=list("Mineral:cake"=list("absent"=1, "present"=2)))
+
+summary.lm(m1)
+
+rm(list=ls())
+load("../data/filterCake.RData")
+ls()
+str(filterCake)
diff --git a/data/filterCake.RData b/data/filterCake.RData
new file mode 100644
index 0000000000000000000000000000000000000000..a0de62bd28138af476f33e6348a87bfd0ee00b62
GIT binary patch
literal 282
zcmb2|=3oE=X6~X+gGXHtk`fXUk`mIAk`j{Gj3Q?=uqZQgGpkQ{=5_jvrl)R^-x<Hu
zgak1*Pv*=x1zm<P)=Qis4IPtDxo_;$Ro|*(x?Cd5h&yD;MS)`mO@=**Ji;cz5tECB
zy1O6xHA~H&HX~+IJWI-7<|MlbZ~pP~Bs6qyQ+EhnH9w*}Ad7$Fy8?rz0vVCsg9jX6
z@^H*44QRfkX6%?Stywc<uHY1YVe__2RRNW;D=dE*RBFgCJEy_RBjcm+=*7hu(`U@?
zn#UJ0x#-j6%?o9|-8r-8%AzAO8q-xJr&ulQTqJbX<lLe^MYc0K7nGd7!l3f+|NsAt
kizfWEXU=MR=;f*7dBt0sDJ!u-WmY}I*29xI)tMO>02I-3Hvj+t

literal 0
HcmV?d00001

diff --git a/man/filterCake.Rd b/man/filterCake.Rd
new file mode 100644
index 0000000..2f65788
--- /dev/null
+++ b/man/filterCake.Rd
@@ -0,0 +1,62 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/legTools.R
+\docType{data}
+\name{filterCake}
+\alias{filterCake}
+\title{Fertilization with filter cake and mineral}
+\format{a \code{data.frame} with 16 records and 4 variables.}
+\source{
+Frederico, P. (2009). Curso de Estatística Experimental (15th
+    ed.). Piracicaba, São Paulo: FEALQ. (page 120)
+}
+\usage{
+data(filterCake)
+}
+\description{
+These data are from an \eqn{2^2} factorial experiment
+    studing the effect of fertilizaton with filter cake (a residual
+    from industrial processing of sugar cane) and traditional mineral
+    fertilization.
+
+\itemize{
+  \item \code{block} a factor with 4 levels.
+  \item \code{mineral} low (-1) and high (+1) levels of mineral
+    fertilization.
+  \item \code{cake} low (-1) and high (+1) levels of fetilization
+    with filter cake.
+  \item \code{y} some response variable. The text book doesn't give
+    any information.
+}
+}
+\examples{
+library(lattice)
+library(latticeExtra)
+
+data(filterCake)
+str(filterCake)
+
+xyplot(y~cake, groups=mineral,
+       auto.key=list(title="Mineral", columns=2),
+       data=filterCake, type=c("p", "a"),
+       ylab="y",
+       xlab="Filter cake level")
+
+m0 <- lm(y~block+(cake+mineral)^2, data=filterCake)
+par(mfrow=c(2,2)); plot(m0); layout(1)
+anova(m0)
+
+summary(m0)
+
+filterCake$Mineral <- factor(filterCake$mineral,
+                             labels=c("absent", "present"))
+
+m1 <- aov(y~block+Mineral/cake, data=filterCake)
+anova(m1)
+
+## Split SS to see effect of cake in each level of mineral.
+summary(m1, split=list("Mineral:cake"=list("absent"=1, "present"=2)))
+
+summary.lm(m1)
+}
+\keyword{datasets}
+
diff --git a/man/vinasseFert.Rd b/man/vinasseFert.Rd
index 981cc37..ae7a366 100644
--- a/man/vinasseFert.Rd
+++ b/man/vinasseFert.Rd
@@ -14,8 +14,9 @@ data(vinasseFert)
 }
 \description{
 These data are from an \eqn{2^2} factorial experiment
-    studing the effect of fertilizaton with vinasse (organic font)
-    and complete mineral fertilization.
+    studing the effect of fertilizaton with vinasse (a residual from
+    industrial processing of sugar cane) and complete mineral
+    fertilization.
 
 \itemize{
   \item \code{block} a factor with 4 levels.
-- 
GitLab