This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
presample<-c(31.6, 32.1, 31.9, 31.7, 32.2, 31.8, 32.0, 31.5, 31.9, 31.7)
sd(presample)
## [1] 0.2221111
power.t.test(n = NULL, delta = 0.1, sd = .2221111, sig.level = 0.05,power = 0.85,type = c("one.sample"), alternative = c("two.sided"))
##
## One-sample t test power calculation
##
## n = 46.25363
## delta = 0.1
## sd = 0.2221111
## sig.level = 0.05
## power = 0.85
## alternative = two.sided
You can also embed plots, for example:
samples<-c(31.6, 32.1, 31.9, 31.7, 32.2, 31.8, 32.0, 31.5, 31.9, 31.7,32.1, 32.0, 32.1, 32.3, 31.9, 31.9, 32.3, 32.2, 31.9, 32.1,31.9, 31.9, 32.1, 31.6, 31.6, 31.9, 31.8, 32.1, 31.8, 31.7,32.3, 32.0, 32.0, 31.7, 31.9, 32.0, 31.7, 32.1, 31.9, 31.9,31.9, 32.4, 32.0, 31.8, 32.2, 31.7, 31.9)
t.test((samples),mu=32)
##
## One Sample t-test
##
## data: (samples)
## t = -2.1047, df = 46, p-value = 0.04081
## alternative hypothesis: true mean is not equal to 32
## 95 percent confidence interval:
## 31.87512 31.99722
## sample estimates:
## mean of x
## 31.93617
dat<-rnorm(40,10,2)
dat
## [1] 7.882557 11.980205 6.344021 7.935011 9.735058 10.276558 11.067262
## [8] 9.115714 8.584399 7.553454 7.277340 11.403191 10.321407 14.220923
## [15] 13.256671 11.310303 8.671719 10.339496 7.967800 14.960663 7.481953
## [22] 12.908511 9.927465 9.864810 11.137998 11.326314 11.013120 10.067421
## [29] 4.630641 12.684088 12.539859 5.752024 7.388837 7.391841 9.460243
## [36] 7.865620 10.638261 11.479858 8.901737 11.930468
hist(dat,main="histogram of collected data",col="gold")
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.