Re:R for Excel Users
by minimaxir on Thursday February 16, 2017 @12:58PM
(#13662032)
A cool feature of select_ I discovered accidently is that you can pass in a vector of column names to get the corresponding columns, which is much easier than abusing which() to lookup indices.
[ Parent
| on HN ]
Re:R for Excel Users
by _Wintermute on Thursday February 16, 2017 @01:11PM
(#13662139)
Not sure if I'm misunderstanding, but you've always been able to slice on a vector of column names.
cols <- c("colA", "colB")
dataframe[, cols]True, although not as a part of a dplyr chain, which is cleaner.
Re:R for Excel Users
by disgruntledphd2 on Thursday February 16, 2017 @01:48PM
(#13662444)
extract and extract2 from magrittr also work. I do normally use dplyr though.