Displaying 2 results from an estimated 2 matches for "lessr".
Did you mean:
  less
  
2017 Jun 21
4
selecting dataframe columns based on substring of col name(s)
...AS, for example). Heuristically, something like:
piece <- df[,col2:col4]
where the heuristic col2:col4 is interpreted as col2 -> col4 (parse the 
prefix 'col', and then simply select over the changing suffic -- i.e., 
column number).
Now, if I use the "to" function in the lessR package, I can get there 
from here fairly easily:
piece <- d[,to("col",4,from=2,same.size=FALSE)]
But, is there a better way? Beyond 'efficiency' (ease of 
implementation), part of what constitutes 'better' might be something in 
base R, rather than relying on a pack...
2017 Jun 21
0
selecting dataframe columns based on substring of col name(s)
...lly, something like:
> 
> piece <- df[,col2:col4]
> 
> where the heuristic col2:col4 is interpreted as col2 -> col4 (parse the prefix 'col', and then simply select over the changing suffic -- i.e., column number).
> 
> Now, if I use the "to" function in the lessR package, I can get there from here fairly easily:
> 
> piece <- d[,to("col",4,from=2,same.size=FALSE)]
> 
> But, is there a better way? Beyond 'efficiency' (ease of implementation), part of what constitutes 'better' might be something in base R, rather than...