Displaying 2 results from an estimated 2 matches for "colxxxxx".
Did you mean:
cgxxxxxx
2017 Jun 21
4
selecting dataframe columns based on substring of col name(s)
...3","col4")]
Works as expected, but for *big* problems (where I might have dozens ->
hundreds of columns -- often the case with big design matrices output by
some linear models program or another), having to write them all out
using c("col2","col3",...."colXXXXX") takes a lot of time. What I'm
wondering about is if there is a way to simply select over the "changing
part" of the column name (you can do this relatively easily in a data
step in SAS, for example). Heuristically, something like:
piece <- df[,col2:col4]
where the heuri...
2017 Jun 21
0
selecting dataframe columns based on substring of col name(s)
...,"col4")]
>
> Works as expected, but for *big* problems (where I might have dozens -> hundreds of columns -- often the case with big design matrices output by some linear models program or another), having to write them all out using c("col2","col3",...."colXXXXX") takes a lot of time. What I'm wondering about is if there is a way to simply select over the "changing part" of the column name (you can do this relatively easily in a data step in SAS, for example). Heuristically, something like:
>
> piece <- df[,col2:col4]
>
>...