From bb3bd66d930f1fd6b01121c2989918881733e963 Mon Sep 17 00:00:00 2001
From: Eduardo Junior <edujrrib@gmail.com>
Date: Fri, 25 Mar 2016 20:59:23 -0300
Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=B5es=20no=20para=20dataset=20Ex1?=
 =?UTF-8?q?.18?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Capitalização do @title
- Indentação no @description
- Altera @examples representando graficamente o proposto no exercício
---
 R/CharnetEx1.18.R    | 29 +++++++++++++++++++------
 man/CharnetEx1.18.Rd | 50 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 6 deletions(-)
 create mode 100644 man/CharnetEx1.18.Rd

diff --git a/R/CharnetEx1.18.R b/R/CharnetEx1.18.R
index 9104719..a4e5584 100644
--- a/R/CharnetEx1.18.R
+++ b/R/CharnetEx1.18.R
@@ -1,9 +1,9 @@
 #' @name CharnetEx1.18
 #' 
-#' @title Tempo e temperatura de uma reação química
+#' @title Tempo e Temperatura de uma Reação Química
 #' 
-#' @description Registro de 35 tempos de reação química em 7 
-#'              temperaturas diferentes
+#' @description Registro de 35 tempos de reação química em 7
+#'     temperaturas diferentes.
 #'
 #' @format Um \code{data.frame} com 2 colunas e 35 linhas.
 #'
@@ -26,6 +26,23 @@
 #'
 #' data(CharnetEx1.18)
 #'
-#' plot(CharnetEx1.18)
-#'
-NULL
\ No newline at end of file
+#' library(ggplot2)
+#'
+#' with(CharnetEx1.18, {
+#'     mu <- aggregate(tempo, list(temp), mean)
+#'     des <- aggregate(tempo, list(temp), sd)
+#'     (da <<- data.frame(x = mu$G, mu = mu$x, sd = des$x))
+#' })
+#'
+#' ggplot(CharnetEx1.18, aes(x = temp, y = tempo)) +
+#'     geom_point() +
+#'     geom_point(
+#'         aes(x = x - 1, y = mu), data = da,
+#'         col = 4, shape = 15, size = 2.5) +
+#'     geom_segment(
+#'         aes(x = x - 1, y = mu - sd, xend = x - 1, yend = mu + sd),
+#'         arrow = arrow(angle = 90, length = unit(0.05, "inches"),
+#'                       ends = "both"), data = da, col = 4) +
+#'     geom_smooth(method = "lm", se = FALSE)
+#'
+NULL
diff --git a/man/CharnetEx1.18.Rd b/man/CharnetEx1.18.Rd
new file mode 100644
index 0000000..4ead5ee
--- /dev/null
+++ b/man/CharnetEx1.18.Rd
@@ -0,0 +1,50 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/CharnetEx1.18.R
+\name{CharnetEx1.18}
+\alias{CharnetEx1.18}
+\title{Tempo e Temperatura de uma Reação Química}
+\format{Um \code{data.frame} com 2 colunas e 35 linhas.
+
+\describe{
+
+\item{\code{temp}}{Temperatura em graus Celsius}
+
+\item{\code{tempo}}{Tempo de reação, em segundos}
+
+}}
+\source{
+Charnet, R., de Luna Freire, C.A., Charnet, E.M.R. & Bonvino,
+    H. (2008). Análise de modelos de regressão linear com aplicações
+    (2nd ed., p. 356). SP: Editora Unicamp (Capítulo 1, exercício 18,
+    página 25)
+}
+\description{
+Registro de 35 tempos de reação química em 7
+    temperaturas diferentes.
+}
+\examples{
+
+data(CharnetEx1.18)
+
+library(ggplot2)
+
+with(CharnetEx1.18, {
+    mu <- aggregate(tempo, list(temp), mean)
+    des <- aggregate(tempo, list(temp), sd)
+    (da <<- data.frame(x = mu$G, mu = mu$x, sd = des$x))
+})
+
+ggplot(CharnetEx1.18, aes(x = temp, y = tempo)) +
+    geom_point() +
+    geom_point(
+        aes(x = x - 1, y = mu), data = da,
+        col = 4, shape = 15, size = 2.5) +
+    geom_segment(
+        aes(x = x - 1, y = mu - sd, xend = x - 1, yend = mu + sd),
+        arrow = arrow(angle = 90, length = unit(0.05, "inches"),
+                      ends = "both"), data = da, col = 4) +
+    geom_smooth(method = "lm", se = FALSE)
+
+}
+\keyword{TODO}
+
-- 
GitLab