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.
knitr::kable(mtcars[1:5,],caption = "Exemplo")
| mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Mazda RX4 | 21.0 | 6 | 160 | 110 | 3.90 | 2.620 | 16.46 | 0 | 1 | 4 | 4 |
| Mazda RX4 Wag | 21.0 | 6 | 160 | 110 | 3.90 | 2.875 | 17.02 | 0 | 1 | 4 | 4 |
| Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.320 | 18.61 | 1 | 1 | 4 | 1 |
| Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1 |
| Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.440 | 17.02 | 0 | 0 | 3 | 2 |
\(A = \pi \times r^{2}\)
norm <- rnorm(100, mean = 0, sd = 1)
A <- c("a", "a", "b", "b")
B <- c(5, 10, 15, 20)
dataframe <- data.frame(A, B)
print(dataframe)
## A B
## 1 a 5
## 2 a 10
## 3 b 15
## 4 b 20
library(dplyr)
A <- c("a", "a", "b", "b")
B <- c(5, 10, 15, 20)
dataframe <- data.frame(A, B)
print(dataframe)
## A B
## 1 a 5
## 2 a 10
## 3 b 15
## 4 b 20
boxplot(B~A,data=dataframe)
plant <- c("a", "b", "c")
temperature <- c(20, 20, 20)
growth <- c(0.65, 0.95, 0.15)
dataframe <- data.frame(plant, temperature, growth)
pander::emphasize.italics.cols(3) # Make the 3rd column italics
pander::pander(dataframe) # Create the table
| plant | temperature | growth |
|---|---|---|
| a | 20 | 0.65 |
| b | 20 | 0.95 |
| c | 20 | 0.15 |
A <- c(20, 15, 10)
B <- c(1, 2, 3)
lm_test <- lm(A ~ B) # Creating linear model
table_obj <- broom::tidy(lm_test) # Using tidy() to create a new R object called table
pander::pander(table_obj, digits = 3) # Using pander() to view the created table, with 3 sig figs
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 25 | 4.07e-15 | 6.14e+15 | 1.04e-16 |
| B | -5 | 1.88e-15 | -2.65e+15 | 2.4e-16 |