On Mar 9, 2012, at 5:31 AM, RMSOPS wrote:

Hello,

    the idea is to copy the d for df, with new results.

x<-data.frame(name="x1",pos=4,age=20)
x<-rbind(x,data.frame(name="x2",pos=5,age=20))
x<-rbind(x,data.frame(name="x3",pos=6,age=21))
x<-rbind(x,data.frame(name="x4",pos=7,age=24))
x<-rbind(x,data.frame(name="x5",pos=8,age=27))
x<-rbind(x,data.frame(name="x6",pos=9,age=26))


x <- data.frame(name=paste("x", 1:6, sep=""),
                pos=3+1:6
                age=c(20,20, 21,24,27,26)


View(x)


d<-NULL
df<-NULL

for(r in 2: nrow(x))
{
 val_user<-x$name[[r]]
 pos<-x$pos[[r]] -4
 age <-x$age[[r]]
 d<-data.frame(val_user,pos,age)
 print(d)
}
df<-rbind(df,d)
View(df)


It is generally better to spend more time describing the problem. Attempting to read the mind of new R users who come from other programming paradigms is often unrewarding.

--
David.

  in df only have the last result, the ideia is have the new results
calculated in the for loop

thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/Copy-dataframe-for-another-tp4456893p4459068.html
Sent from the R help mailing list archive at Nabble.com.

PLEASE: Include context. We are NOT reading this on Nabble.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to