n(paste0(var,"_cs"),
> cumsum(get(df)[[var]]
> }}
> ls()[grep("df_",ls())]
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Daniel Egan
> Sent: Donnerstag, 25. April 2013 22:19
ril 2013 22:19
To: r-help@r-project.org
Subject: [R] Looping through names of both dataframes and column-names
Hello all,
This seems like a pretty standard question - suppose I want to loop
through a set of similar data-frames, with similar variables, and create
new variables within them:
nl&l
Hello all,
This seems like a pretty standard question - suppose I want to loop through
a set of similar data-frames, with similar variables, and create new
variables within them:
nl<-seq(1,5)for (i in nl) {
assign(paste0("df_",nl[i]),data.frame(x=seq(1:10),y=rnorm(10)))}
ls()[grep("df_",ls())]
3 matches
Mail list logo