This report is automatically generated with the R
package knitr
(version 1.5
)
.
# Chapter 2 - Exploring R Working with a Code Editor Exploring RGui Seeing the naked R # console Issuing a simple command 24 + 7 + 11
## [1] 42
24 + 7 + 11
## [1] 42
### Closing the console q() Dressing up with RStudio Starting Your First R Session Saying ### hello to the world print("Hello world!")
## [1] "Hello world!"
print("Hello world!")
## [1] "Hello world!"
## Doing simple math 1 + 2 + 3 + 4 + 5
## [1] 15
## Using vectors c(1, 2, 3, 4, 5)
## [1] 1 2 3 4 5
1:5
## [1] 1 2 3 4 5
sum(1:5)
## [1] 15
## Storing and calculating values x <- 1:5 x
## [1] 1 2 3 4 5
y <- 10 x + y
## [1] 11 12 13 14 15
x
## [1] 1 2 3 4 5
y
## [1] 10
z <- x + y z
## [1] 11 12 13 14 15
h <- "Hello" h
## [1] "Hello"
hw <- c("Hello", "world!") hw
## [1] "Hello" "world!"
paste("Hello", "world!")
## [1] "Hello world!"
## Talking back to the user h <- "Hello" yourname <- readline("What is your name?") paste(h, yourname)
## [1] "Hello Andrie"
# Sourcing a Script h <- "Hello" yourname <- readline("What is your name?") print(paste(h, yourname))
## [1] "Hello "
### Finding help on functions `?`(paste) help(paste) # Navigating the Workspace ls()
## [1] "h" "hw" "x" "y" "yourname" "z"
## Manipulating the content of the workspace rm(z) ls()
## [1] "h" "hw" "x" "y" "yourname"
## Saving your work getwd()
## [1] "C:/Users/Andrie/Documents/GitHub/rfordummies/rfordummies/inst/scripts/3-html"
save(yourname, file = "yourname.rda") ## Retrieving your work rm(yourname) load("yourname.rda")
The R session information (including the OS info, R version and all packages used):
sessionInfo()
## R version 3.0.2 (2013-09-25) ## Platform: x86_64-w64-mingw32/x64 (64-bit) ## ## locale: ## [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 ## [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C ## [5] LC_TIME=English_United Kingdom.1252 ## ## attached base packages: ## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: ## [1] BiocInstaller_1.12.1 ggplot2_0.9.3.1 reshape2_1.2.2 sos_1.3-8 ## [5] brew_1.0-6 stringr_0.6.2 knitr_1.5 plyr_1.8 ## [9] Revobase_7.1.0 RevoMods_7.1.0 RevoScaleR_7.1.0 lattice_0.20-27 ## [13] rpart_4.1-2 ## ## loaded via a namespace (and not attached): ## [1] codetools_0.2-8 colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 ## [5] evaluate_0.5.1 foreach_1.4.1 formatR_0.10 grid_3.0.2 ## [9] gtable_0.1.2 highr_0.3 iterators_1.0.6 labeling_0.2 ## [13] MASS_7.3-29 munsell_0.4.2 proto_0.3-10 RColorBrewer_1.0-5 ## [17] scales_0.2.3 tools_3.0.2
Sys.time()
## [1] "2014-05-13 15:05:18 BST"