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:R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> knitr::kable()
Error in inherits(x, "list") : argument "x" is missing, with no default
> knitr::kable()
Error in inherits(x, "list") : argument "x" is missing, with no default
> install (tidyverse)
Error in install(tidyverse) : could not find function "install"
> tidyverse
Error: object 'tidyverse' not found
> install.packages(tidyverse)
Error in install.packages : object 'tidyverse' not found
> install.packages(tidyverse)
Error in install.packages : object 'tidyverse' not found
> install.packages(tinytex)
Error in install.packages : object 'tinytex' not found
> head()
Error in checkHT(n, dx <- dim(x)) :
argument "x" is missing, with no default
> cran
Error: object 'cran' not found
> install.packages("tidyverse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘assertthat’, ‘blob’, ‘DBI’, ‘gargle’, ‘uuid’, ‘ids’, ‘selectr’, ‘dbplyr’, ‘dtplyr’, ‘googledrive’, ‘googlesheets4’, ‘lubridate’, ‘modelr’, ‘reprex’, ‘rvest’, ‘xml2’
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/assertthat_0.2.1.zip'
Content type 'application/zip' length 55086 bytes (53 KB)
downloaded 53 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/blob_1.2.2.zip'
Content type 'application/zip' length 48267 bytes (47 KB)
downloaded 47 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/DBI_1.1.1.zip'
Content type 'application/zip' length 688987 bytes (672 KB)
downloaded 672 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/gargle_1.2.0.zip'
Content type 'application/zip' length 538082 bytes (525 KB)
downloaded 525 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/uuid_0.1-4.zip'
Content type 'application/zip' length 33859 bytes (33 KB)
downloaded 33 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ids_1.0.1.zip'
Content type 'application/zip' length 124032 bytes (121 KB)
downloaded 121 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/selectr_0.4-2.zip'
Content type 'application/zip' length 490736 bytes (479 KB)
downloaded 479 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/dbplyr_2.1.1.zip'
Content type 'application/zip' length 835704 bytes (816 KB)
downloaded 816 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/dtplyr_1.1.0.zip'
Content type 'application/zip' length 242699 bytes (237 KB)
downloaded 237 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/googledrive_2.0.0.zip'
Content type 'application/zip' length 1872757 bytes (1.8 MB)
downloaded 1.8 MB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/googlesheets4_1.0.0.zip'
Content type 'application/zip' length 492352 bytes (480 KB)
downloaded 480 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/lubridate_1.8.0.zip'
Content type 'application/zip' length 1716281 bytes (1.6 MB)
downloaded 1.6 MB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/modelr_0.1.8.zip'
Content type 'application/zip' length 203149 bytes (198 KB)
downloaded 198 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/reprex_2.0.1.zip'
Content type 'application/zip' length 500568 bytes (488 KB)
downloaded 488 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/rvest_1.0.2.zip'
Content type 'application/zip' length 207675 bytes (202 KB)
downloaded 202 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/xml2_1.3.2.zip'
Content type 'application/zip' length 3006790 bytes (2.9 MB)
downloaded 2.9 MB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tidyverse_1.3.1.zip'
Content type 'application/zip' length 430233 bytes (420 KB)
downloaded 420 KB
package ‘assertthat’ successfully unpacked and MD5 sums checked
package ‘blob’ successfully unpacked and MD5 sums checked
package ‘DBI’ successfully unpacked and MD5 sums checked
package ‘gargle’ successfully unpacked and MD5 sums checked
package ‘uuid’ successfully unpacked and MD5 sums checked
package ‘ids’ successfully unpacked and MD5 sums checked
package ‘selectr’ successfully unpacked and MD5 sums checked
package ‘dbplyr’ successfully unpacked and MD5 sums checked
package ‘dtplyr’ successfully unpacked and MD5 sums checked
package ‘googledrive’ successfully unpacked and MD5 sums checked
package ‘googlesheets4’ successfully unpacked and MD5 sums checked
package ‘lubridate’ successfully unpacked and MD5 sums checked
package ‘modelr’ successfully unpacked and MD5 sums checked
package ‘reprex’ successfully unpacked and MD5 sums checked
package ‘rvest’ successfully unpacked and MD5 sums checked
package ‘xml2’ successfully unpacked and MD5 sums checked
package ‘tidyverse’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpUXKz6y\downloaded_packages
> install.packages("tinytex")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tinytex_0.34.zip'
Content type 'application/zip' length 124048 bytes (121 KB)
downloaded 121 KB
package ‘tinytex’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpUXKz6y\downloaded_packages
> install.packages("knitr")
Error in install.packages : Updating loaded packages
Restarting R session...
> install.packages("knitr")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/knitr_1.36.zip'
Content type 'application/zip' length 1469295 bytes (1.4 MB)
downloaded 1.4 MB
package ‘knitr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpyOLfdu\downloaded_packages
> install.packages("flexdashboard")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/flexdashboard_0.5.2.zip'
Content type 'application/zip' length 189850 bytes (185 KB)
downloaded 185 KB
package ‘flexdashboard’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpyOLfdu\downloaded_packages
> install.packages("xaringan")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependency ‘servr’
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/servr_0.23.zip'
Content type 'application/zip' length 89696 bytes (87 KB)
downloaded 87 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/xaringan_0.22.zip'
Content type 'application/zip' length 144537 bytes (141 KB)
downloaded 141 KB
package ‘servr’ successfully unpacked and MD5 sums checked
package ‘xaringan’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpyOLfdu\downloaded_packages
> isntall.packages("xaringanthemer")
Error in isntall.packages("xaringanthemer") :
could not find function "isntall.packages"
> install.packages("xaringanthemer")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Fernando/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependency ‘whisker’
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/whisker_0.4.zip'
Content type 'application/zip' length 83321 bytes (81 KB)
downloaded 81 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/xaringanthemer_0.4.0.zip'
Content type 'application/zip' length 1330107 bytes (1.3 MB)
downloaded 1.3 MB
package ‘whisker’ successfully unpacked and MD5 sums checked
package ‘xaringanthemer’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Fernando\AppData\Local\Temp\RtmpyOLfdu\downloaded_packages
> library("tidyverse")
-- Attaching packages -------------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5 v purrr 0.3.4
v tibble 3.1.3 v dplyr 1.0.7
v tidyr 1.1.3 v stringr 1.4.0
v readr 2.0.1 v forcats 0.5.1
-- Conflicts ----------------------------------------------- tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag() masks stats::lag()
> library("tinytex")
> library("knitr")
> library("flexdashboard")
> library("xaringan")
> library("xaringanthemer")
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> Q1)
Error: unexpected ')' in "Q1)"
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1)```{r}
Error: unexpected ')' in "Q1)"
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1)
Error: unexpected ')' in "Q1)"
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1
Error: object 'Q1' not found
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1()
Error in Q1() : could not find function "Q1"
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1)
Error: unexpected ')' in "Q1)"
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> Q1)
Error: unexpected ')' in "Q1)"
>
> ```{r}
Error: attempt to use zero-length variable name
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> ```
Error: attempt to use zero-length variable name
> str(Mtcars)
Error in str(Mtcars) : object 'Mtcars' not found
> Head(mtcars)
Error in Head(mtcars) : could not find function "Head"
> head(Mtcars)
Error in head(Mtcars) : object 'Mtcars' not found
> head(mtcars)
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
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
> str(Mtcars)
Error in str(Mtcars) : object 'Mtcars' not found
> str(mtcars)
'data.frame': 32 obs. of 11 variables:
$ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
$ cyl : num 6 6 4 6 8 6 8 4 4 6 ...
$ disp: num 160 160 108 258 360 ...
$ hp : num 110 110 93 110 175 105 245 62 95 123 ...
$ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
$ wt : num 2.62 2.88 2.32 3.21 3.44 ...
$ qsec: num 16.5 17 18.6 19.4 17 ...
$ vs : num 0 0 1 1 0 1 0 1 1 1 ...
$ am : num 1 1 1 0 0 0 0 0 0 0 ...
$ gear: num 4 4 4 3 3 3 3 4 4 4 ...
$ carb: num 4 4 1 1 2 1 4 2 2 4 ...
> dim[mtcars]
Error in dim[mtcars] : object of type 'builtin' is not subsettable
> dim(mtcars)
[1] 32 11
> nomes(mtcars)
Error in nomes(mtcars) : could not find function "nomes"
> names(mtcars)
[1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" "carb"
> head(mtcars, x = 10)
Error in checkHT(n, dx <- dim(x)) :
invalid 'n' - must have length one when dim(x) is NULL, got 11
> head(mtcars, x = 10)
Error in checkHT(n, dx <- dim(x)) :
invalid 'n' - must have length one when dim(x) is NULL, got 11
> head(mtcars)
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
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
> v1 <- ("pato", "cachorro", "minhoca", "lagarto")
Error: unexpected ',' in "v1 <- ("pato","
> v1 <- ("pato","cachorro","minhoca","lagarto")
Error: unexpected ',' in "v1 <- ("pato","
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v2 <- c("1", "2", "3", "4")
> v1 + 42
Error in v1 + 42 : non-numeric argument to binary operator
> v2 + 42
Error in v2 + 42 : non-numeric argument to binary operator
> v2 <- v2+42
Error in v2 + 42 : non-numeric argument to binary operator
> v2 <- c("1", "2", "3", "4")
> v1 + 42
Error in v1 + 42 : non-numeric argument to binary operator
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v1 <- c("pato", "cachorro", "minhoca", "lagarto"
Error: Incomplete expression: v1 <- c("pato", "cachorro", "minhoca", "lagarto"
> v3 <- c(33 31 40 25 27 40)
Error: unexpected numeric constant in "v3 <- c(33 31"
> v3 <- c(33 31 40 25 27 40)
Error: unexpected numeric constant in "v3 <- c(33 31"
> v3 <- c(33, 31, 40, 25, 27, 40)
> v1 <- c(pato, cachorro, minhoca, lagarto)
Error: object 'pato' not found
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v3 <- c(33, 31, 40, 25, 27, 40)
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v3 <- c(33, 31, 40, 25, 27, 40)
> myData <- data.frame(v1, v3)
Error in data.frame(v1, v3) :
arguments imply differing number of rows: 4, 6
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v3 <- c(33, 31, 40, 25, 27, 40)
> myData <- data.frame(v1, v3)
Error in data.frame(v1, v3) :
arguments imply differing number of rows: 4, 6
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> mydata <- data.frame(v1, v3)
Error in data.frame(v1, v3) :
arguments imply differing number of rows: 4, 6
> mydata <- data.frame(v1;v3)
Error: unexpected ';' in "mydata <- data.frame(v1;"
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto", NA, NA)
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto",NA,NA)
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto","","")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> v1 <- c("pato", "cachorro", "minhoca", "lagarto", NA, NA)
> myData <- data.frame(v1, v3)
> v1 <- c("pato", "cachorro", "minhoca", "lagarto")
> v4 <- c(33, 31, 40, 25)
> myData <- data.frame(v1 = animal, v4 = idade)
Error in data.frame(v1 = animal, v4 = idade) : object 'animal' not found
> v1 <- c("pato", "cachorro"", "minhoca", "lagarto")
Error: unexpected string constant in "v1 <- c("pato", "cachorro"", ""
> names(myData) <- c("animal","idade")
> ls
function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
pattern, sorted = TRUE)
{
if (!missing(name)) {
pos <- tryCatch(name, error = function(e) e)
if (inherits(pos, "error")) {
name <- substitute(name)
if (!is.character(name))
name <- deparse(name)
warning(gettextf("%s converted to character string",
sQuote(name)), domain = NA)
pos <- name
}
}
all.names <- .Internal(ls(envir, all.names, sorted))
if (!missing(pattern)) {
if ((ll <- length(grep("[", pattern, fixed = TRUE))) &&
ll != length(grep("]", pattern, fixed = TRUE))) {
if (pattern == "[") {
pattern <- "\\["
warning("replaced regular expression pattern '[' by '\\\\['")
}
else if (length(grep("[^\\\\]\\[<-", pattern))) {
pattern <- sub("\\[<-", "\\\\\\[<-",
pattern)
warning("replaced '[<-' by '\\\\[<-' in regular expression pattern")
}
}
grep(pattern, all.names, value = TRUE)
}
else all.names
}
R Markdown
{r cars} summary(cars)
You can also embed plots, for example:
{r pressure, echo=FALSE} plot(pressure)
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.