search for: indxli

Displaying 1 result from an estimated 1 matches for "indxli".

Did you mean: indx
2011 Mar 15
1
Questions on dividing lists and tapply
...he tapply function. tapply(1:5,list(c(1,1,2,2,3),c(1,2,1,1,3)),sum) will give me: 1 2 3 1 1 2 NA 2 7 NA NA 3 NA NA 5 The index here is a list: list(c(1,1,2,2,3),c(1,2,1,1,3)). However, if I get the same index list through one of the other apply functions (like by) for example, indxLi<-by(rbind(c(1,1,2,2,3),c(1,2,1,1,3)),1:2,function(x){return(x)}) then the tapply no longer works with this list. tapply(1:5,indxLi,sum) gives me the error: Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list? Is there a way to use...