[R] Copy dataframe for another

R. Michael Weylandt michael.weylandt at gmail.com
Thu Mar 8 17:35:26 CET 2012


What goes wrong? Your code isn't reproducible and you didn't give an
error message. I'd mention that "d <- Null" does not assign NULL to d
which might lead to a dimension mismatch at some point. Also,
something about your loop syntax seems funny: you are looping over
rows but selecting columns of your data frame -- seems dangerous.

Can you post a minimal working example including data (with dput()) ?

Michael

On Thu, Mar 8, 2012 at 11:26 AM, RMSOPS <ricardosousa2000 at clix.pt> wrote:
>
> I'm trying to copy the results of a dataframe to another within a cycle for
> but I am not able to implement the rbind, because give th
>
> 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,)
>      print(d)
>    }
>  df<-rbind(df,d)
> }
>
> someone can help me solve this
>
>   Thanks
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Copy-dataframe-for-another-tp4456879p4456879.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list