Skip to content

Commit 56125e1

Browse files
author
jonsan21
committed
R script
1 parent 59513b4 commit 56125e1

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

1.Introduction/Introduction.R

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#A first session
2+
3+
set.seed(476)
4+
x<-rnorm(100)
5+
head(x)
6+
mean(x)
7+
sd(x)
8+
min(x)
9+
max(x)
10+
11+
#Basic operations
12+
13+
2+2
14+
7*17
15+
sqrt(9)
16+
3^3
17+
log(7)
18+
log10(7)
19+
20+
#Precision
21+
22+
sin(pi/2)
23+
pi
24+
options(digits=22)
25+
pi
26+
27+
#Infinity or not defined, and missings
28+
29+
1/0
30+
2*Inf
31+
-1/0
32+
0/0
33+
c(1,2,3,NA,5)
34+
mean(c(1,2,3,NA,5))
35+
36+
#Assignments to variables
37+
38+
rm(list=ls())
39+
options(digits=7)
40+
x <- 5
41+
x
42+
# x=5 can be used; not recommended
43+
x*x
44+
y <- x+5
45+
ls()
46+
rm(x)
47+
ls()
48+
49+
#Internal help function
50+
51+
?mean # shorthand for help(mean)
52+
example(mean)
53+
??"fitting linear model" # shorthand for
54+
# help.search("fitting linear model")
55+
#Manuals
56+
57+
help.start()

0 commit comments

Comments
 (0)