Re: [R] adding tables

2013-12-10 Thread Eik Vettorazzi
How about this: t2 <- table(c(10,11,12,13)) t1 <-table(c(1,1,2,4,5)) t12<-(rbind(as.data.frame(t1),as.data.frame(t2))) xtabs(Freq~.,t12) it works for "overlapping" tables t2 <- table(c(10,11,12,13,1,2)) t1 <-table(c(1,1,2,4,5,11,12)) t12<-(rbind(as.data.frame(t1),as.data.frame(t2))) xtabs(Freq~.,

Re: [R] adding tables

2013-12-09 Thread arun
HI, May be this helps: t2 <- table(c(10,11,12,13))  t1 <-table(c(1,1,2,4,5)) t <- c(t1,t2) tapply(t,sort(as.numeric(names(t))),sum) A.K. On Monday, December 9, 2013 7:01 PM, Ross Boylan wrote: Can anyone recommend a good way to add tables? Ideally I would like t1 <- table(x1) t2 <- table(x2)

Re: [R] adding tables [solution]

2013-12-09 Thread Ross Boylan
On Mon, 2013-12-09 at 16:09 -0800, Ross Boylan wrote: > Answering myself... > On Mon, 2013-12-09 at 15:59 -0800, Ross Boylan wrote: > > Can anyone recommend a good way to add tables? > For count data, which were my main concern, it looks as if tabulate with > nbins will work. I'm not sure how this

Re: [R] adding tables

2013-12-09 Thread David Winsemius
On Dec 9, 2013, at 3:59 PM, Ross Boylan wrote: > Can anyone recommend a good way to add tables? > Ideally I would like > t1 <- table(x1) > t2 <- table(x2) > t1+t2 > > It t1 and t2 have the same levels this works fine, but I need something > that will work even if they differ, e.g., >> t1 > > 1

Re: [R] adding tables [partial solution]

2013-12-09 Thread Ross Boylan
On Mon, 2013-12-09 at 16:20 -0800, Roy Mendelssohn wrote: > Is this what you are after? > > http://www.statmethods.net/management/merging.html Not directly. Something could probably be fashioned using it and as.data.frame on the result of table(), but merge doesn't sum values. Ross > > -Roy > O

Re: [R] adding tables [partial solution]

2013-12-09 Thread Roy Mendelssohn
Is this what you are after? http://www.statmethods.net/management/merging.html -Roy On Dec 9, 2013, at 4:09 PM, Ross Boylan wrote: > Answering myself... > On Mon, 2013-12-09 at 15:59 -0800, Ross Boylan wrote: >> Can anyone recommend a good way to add tables? > For count data, which were my main

Re: [R] adding tables [partial solution]

2013-12-09 Thread Ross Boylan
Answering myself... On Mon, 2013-12-09 at 15:59 -0800, Ross Boylan wrote: > Can anyone recommend a good way to add tables? For count data, which were my main concern, it looks as if tabulate with nbins will work. I'm not sure how this works with a cross-classifying factor, which I will also need.

[R] adding tables

2013-12-09 Thread Ross Boylan
Can anyone recommend a good way to add tables? Ideally I would like t1 <- table(x1) t2 <- table(x2) t1+t2 It t1 and t2 have the same levels this works fine, but I need something that will work even if they differ, e.g., > t1 1 2 4 5 2 1 1 1 > t2 <- table(c(10, 11, 12, 13)) > t1+t2 # apparen