1

How can I rbind a list of data frames using only specific columns? Something like do.call(rbind, data) works fine, but I dont't know how to exclude a vector of specific columns. Dropping unnecessary columns afterwards seems is ok, but maybe there is a cleaner way to do this?

3
  • 5
    See: How to drop columns by name in a data frame Commented Feb 3, 2016 at 12:19
  • 1
    Do you want to merge or rbind? You need to get your definitions straight. Commented Feb 3, 2016 at 12:35
  • Edit original post. I want to use rbind. Commented Feb 3, 2016 at 13:24

1 Answer 1

1

I can simply use subset (thanks to @Jaap):

do.call(rbind, lapply(data, subset, select=c("use_this", "and_this")))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.