stat545a-2013-hw01_lee-woo.R

LWY — Sep 13, 2013, 8:16 PM


# a useful command on changing the locale:

Sys.setenv(lang="EN")

# an exercise on vectors:

x <- rnorm(5, mean=10^(1:5), sd=10^(1:5))
x
[1]     -9.945    157.653   2266.535   5158.233 179833.308

y <- 1:3
z <- 3:7
y + z
Warning: longer object length is not a multiple of shorter object length
[1] 4 6 8 7 9

names(z)=letters[seq_along(z)]
z
a b c d e 
3 4 5 6 7 
z[c(-2,-5)]
a c d 
3 5 6