Skip to content
Prev 274166 / 398506 Next

Append data to vector form a column of a dataframe

In addition to Ivan, test$a is not a data.frame anymore but a numerical vector.
[1] "numeric"
[1] 1 2 3

So adding a row to your data.frame would be?
? a
1 1
2 2
3 3
4 2


?
Wolfgang Wu


----- Urspr?ngliche Message -----
Von: Ivan Calandra <ivan.calandra at uni-hamburg.de>
An: r-help at 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$a, 2)? ## you wrote "3" but meant "2" I guess

HTH,
Ivan

Le 10/12/2011 10:47, behave a ?crit :