[R] Append data to vector form a column of a dataframe

2011-10-12 Thread behave
Dear R-community, When doing this: test-data.frame(a=c(1,2,3)) rbind(test$a, 3) I expect something like: 1 2 3 2 but get: [,1] [,2] [,3] [1,]123 [2,]222 the same for: rbind(test[[a]], 2) or rbind(as.vector(test[[a]]), 2) or rbind(t(as.vector(test[[a]])),

Re: [R] Append data to vector form a column of a dataframe

2011-10-12 Thread Ivan Calandra
Hi Dom, This is because 3 is recycled. It is necessary because the number of columns have to be the same for every row. Try this instead: c(test$a, 2) ## you wrote 3 but meant 2 I guess HTH, Ivan Le 10/12/2011 10:47, behave a écrit : Dear R-community, When doing this:

Re: [R] Append data to vector form a column of a dataframe

2011-10-12 Thread Wolfgang Wu
-hamburg.de An: r-help@r-project.org Cc: Gesendet: 11:19 Mittwoch, 12.Oktober 2011 Betreff: Re: [R] Append data to vector form a column of a dataframe Hi Dom, This is because 3 is recycled. It is necessary because the number of columns have to be the same for every row. Try this instead: c(test

Re: [R] Append to a vector?

2008-08-08 Thread Bjørn-Helge Mevik
Why not simply a - c(a, 5) or a - c(a, b) if b is another vector. -- Bjørn-Helge Mevik __ 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

[R] Append to a vector?

2008-08-07 Thread rkevinburton
This is probably an extemly easy operation I just could not find out how to do it. I simple want to append to a vector. a - c(1,2,3,4) a - union(a, c(5)) I want to append the value 5 or even another vector. Or is the a better way? Kevin __