Professional Documents
Culture Documents
Lesson 1
Lesson 1
> c(1,4,2,1)
[1] 1 4 2 1
> x<- c(1,4,2,1)
> x
[1] 1 4 2 1
> x= c(1,4,2,1)
> x
[1] 1 4 2 1
> a<-c(1,2,3,4)
> a
[1] 1 2 3 4
> a=5
> a<-c(1,2,3,4)
> a+5
[1] 6 7 8 9
> a-10
[1] -9 -8 -7 -6
> a*2
[1] 2 4 6 8
> a/5
[1] 0.2 0.4 0.6 0.8
> x-a
[1] 0 2 -1 -3
> x/a
[1] 1.0000000 2.0000000 0.6666667 0.2500000
> length(x)
[1] 4
> y<-c(9,7,10)
> y
[1] 9 7 10
> x-y
[1] -8 -3 -8 -8
Warning message:
In x - y : longer object length is not a multiple of shorter object length
> length(x-a)
[1] 4
> save.image("C:\\Users\\YL\\Desktop\\NUS\\DSA1101\\Lesson 1")
>