Hi All,
> d = data.frame(a=1:10,b=1:10)
> by1 = rep(c("a","b"),5)
> by(d, by1, function(z) z[,,drop=F])
by1: a
a b
1 1 1
3 3 3
5 5 5
7 7 7
9 9 9
------------------------------------------------------------
by1: b
a b
2 2 2
4 4 4
6 6 6
8 8 8
10 10 10
> by(d, by1, function(z) z[,1,drop=F])
[1] 1 3 5 7 9
------------------------------------------------------------
[1] 2 4 6 8 10
Can somebody explain why are the dimnames (i.e. by1: a by1: b) not
there this time.
Many Thanks
Utkarsh
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.