Creating vectors
Functions to generate vectors
> x=1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x=seq(10)
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x=seq(1,20,2)
> x
[1] 1 3 5 7 9 11 13 15 17 19
> x=rep(10,5)
> x
[1] 10 10 10 10 10
Summary Statistics
> x <-c(1,3,5,7,9,2,4,6,8,-1)
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.00 2.25 4.50 4.40 6.75 9.00
Statistical functions
> x <-c(1,3,5,7,9,2,4,6,8,-1)
> length(x)
[1] 10
> min(x)
[1] -1
> max(x)
[1] 9
> sort(x)
[1] -1 1 2 3 4 5 6 7 8 9
> median(x)
[1] 4.5
> mean(x)
[1] 4.4
> sd(x)
[1] 3.204164
> var(x)
[1] 10.26667
> quantile(x,0.25)
25%
2.25
> quantile(x,0.75)
75%
6.75