Hi All,
I have a data frame pop:
id xloc yloc size
1 1 101295
2 211 1081
And I want to add the vector rec to the data frame n times (without
using a loop):
rec=c(3, 5, 5, 10)
n=2
The result I want:
id xloc yloc size
1 1 1012 95
2
On 2011-02-22 14:48, Nicolas Gutierrez wrote:
Hi All,
I have a data frame pop:
id xloc yloc size
1 1 101295
2 211 1081
And I want to add the vector rec to the data frame n times (without
using a loop):
rec=c(3, 5, 5, 10)
n=2
The result I
That worked.. thanks Peter
On 2/22/2011 5:40 PM, Peter Ehlers wrote:
popm - as.matrix(pop)
recm - matrix(rep(rec, n), nr=n, byrow=TRUE)
newpop - data.frame(rbind(popm, recm))
__
R-help@r-project.org mailing list
3 matches
Mail list logo