-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_getting_started.R
76 lines (52 loc) · 1.1 KB
/
01_getting_started.R
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# M.J. Crawley "The R Book", 2007
# 1. Getting Started
#
# 1. Packages used in the book
source("lib_load.R")
# 2. List of current contributors
citation()
# 3. Help about function
?read.table
# 4. Find function by name
help.search("data input")
# 5. Find package by function
find("lowess")
# 6. Names of all objects in the search list
apropos("lm")
# 7. Example of function
example("lm")
# 8. Demo of function
demo(persp())
# 9. Call library package
library(spatial)
# 10. Content of package
library(help=spatial)
# 11. Objects in package
# 11.1. List of attached packages
search()
# 11.2. Find package
objects(grep("spatial", search()))
# 12. How to use function
?toupper
# 13. View data set 'mtcars'
View(mtcars)
# 14. Names of columns
names(mtcars)
# 15. Example of analysis of covariance
# 15.1. Attach data set
attach(mtcars)
# 15.2. Model
model <- lm(mpg ~ cyl + disp)
# 15.3. Result review
model
summary(model)
# 15.4. Turn off "*"
options(show.signif.stars = FALSE)
summary(model)
# 15.5. Detach data set
detach(mtcars)
# 16. Variables in session
objects()
# 17. Clean space
rm(list = ls())