Notebook of Reading Books: R in Action_Chapter 1.
This chapter covers
To summary, R can
-
Access data from a wide range of sources;
-
Merge the pieces of data together;
-
Clean and annotate data;
-
Analyze cleaned data with the latest methods;
-
Present the findings in meaningful and graphically appealing ways;
-
Incorporate the results into attractive reports that can be distributed to stakeholders and the public.
Attach is the Script of chapter1.
Show me the code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Remove most objects from the working environment
rm(list = ls())
# a tremendously versatile and impressive code
options(stringsAsFactors = F)
# Section 1.3.2 Getting help
help.start()
## Section 1.3.3 Functions for managing the R workspace
getwd()
setwd("mydirectory")
ls() # List the objects in the current workspace.
rm(objectlist) # Remove (delete) one or more objects.
options() # View or set current options.
history() # Display your last # commands (default = 25).
save()
load()
q()
## Section 1.3.4 Input and Output
# Input
source("filename")
source("script1.R") # Working through an example.
# Output
sink("myoutput", append=TRUE, split=TRUE)
pdf("mygraphs.pdf")
source("script2.R")
sink()
dev.off()
source("script3.R")
|