[R] bind select data frames

Joshua Wiley jwiley.psych at gmail.com
Wed Jun 2 16:48:13 CEST 2010


Hello,

Does this do what you are looking for?

############
output <- NULL
for(i in paste("DailyPL", sel, sep="")[-1]){
  output <- rbind(output, get(i))
  }
############

If you just want to rbind all the data frames, there are ways of doing
it without a loop too, but since you specifically asked with the
condition for(i in sep[-1]) I did it using a loop.

Best regards,

Josh


On Wed, Jun 2, 2010 at 7:24 AM, arnaud Gaboury <arnaud.gaboury at gmail.com> wrote:
> Dear group,
>
> Here is my environment:
>
>> ls()
>  [1] "DailyPL100419" "DailyPL100420" "DailyPL100421" "dd"            "i"
> "l"             "PLglobal"      "Pos100416"     "Pos100419"     "Pos100420"
> "Pos100421"     "position"
> [13] "result"        "sel"           "Trad100416"    "Trad100419"
> "Trad100420"    "Trad100421"    "trade"
>
> With "sel" the following element :
>
> sel <-
> c("100419", "100420", "100421")
>
>
> "DailyPL100419" , "DailyPL100420","DailyPL100421" are all data frames with
> same columns names. I want to rbind them with this condition :
>
>
> for (i in sel[-1])
>
> I have no idea how to write it.
>
> TY for any help
>
> ______________________________________________
> 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.
>



-- 
Joshua Wiley
Senior in Psychology
University of California, Riverside
http://www.joshuawiley.com/



More information about the R-help mailing list