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:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.
library(lattice)#绘图包
airquality$Month<-factor(airquality$Month)
xyplot(Temp~Ozone|Month,data = airquality,layout=c(5,1))#附加条件,就是在不同的月份下的温度与二氧化碳的情况,所以值得重视,layout是一个布局参数,五行一列
ggstatsplot::ggscatterstats(
data = ggplot2::msleep,
x = sleep_rem,
y = awake,
xlab = "REM sleep (in hours)",
ylab = "Amount of time spent awake (in hours)",
title = "Understanding mammalian sleep",
messages = FALSE
)
## Registered S3 method overwritten by 'broom.mixed':
## method from
## tidy.gamlss broom
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
###注意:1、点之间才能写代码,会识别,直接在r的花括号中echo=-将代码隐藏掉了。然后在花括号之外可以直接谢代码了。2、最好是在R上写完之后把他转移过来。3、同级标题间要隔开一行,但是不同级之间直接挨着就可以,注意有序和无序之间的区别!!直接打字会显示,三个星号,又斜又粗)