Site hosted by Angelfire.com: Build your free website today!

Using Lists :

> md <- c("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w",+ "x",  "y","z")  # [Here you find + sign which should come after an incomplete command line. So whenever you see a + just type / copy all the commands from   > presented just before + s line and until the next > comes.]
> m.list <- list(m.frame,md)
> m.list  #  [Lists are used in S language just to merge two type of data with different patterns.]
[[1]]:
   c1 c2 c3     mc
r1  1  2  3  Dhaka
r2  4  5  6 Khulna

[[2]]:
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
> m.list[[1]][1,2]
[1] 2
> m.list[[2]][22]
[1] "v"
> apply(m.list[[1]][,1:3],2,min)
 c1 c2 c3
  1  2  3
> apply(m.list[[1]][,1:3],2,mean)
  c1  c2  c3
 2.5 3.5 4.5

Back to Index page