regex - Wildcard character -
i've dataframe, , i'm trying select columns properties in name.
one example (of many) want select columns called "t*_b**"
*
wildcard character. select columns names t1_b2, t2_b2, t3_b2 , t4_b2 (as several others t1_b13, t2_b13 etc.).
if there such wildcard character use, know use following command:
grep("t*_b", names(df))
as opposed doing:
c(grep("t1_b", names(df)), grep("t2_b", names(df)), grep("t3_b", names(df)), grep("t4_b", names(df)))
which messier , harder read.
update: first comment has resolved issue. don't have real need further input, help!
the wildcard 'character' in regular expressions .
. such,
grep("t._b", names(df))
Comments
Post a Comment