[R] Removing variables from data frame with a wile card
Steven T. Yen
@tyen @end|ng |rom ntu@edu@tw
Sat Jan 14 07:56:25 CET 2023
I have a data frame containing variables "yr3",...,"yr28".
How do I remove them with a wild card----something similar to "del yr*"
in Windows/doc? Thank you.
> colnames(mydata)
[1] "year" "weight" "confeduc" "confothr" "college"
[6] ...
[41] "yr3" "yr4" "yr5" "yr6" "yr7"
[46] "yr8" "yr9" "yr10" "yr11" "yr12"
[51] "yr13" "yr14" "yr15" "yr16" "yr17"
[56] "yr18" "yr19" "yr20" "yr21" "yr22"
[61] "yr23" "yr24" "yr25" "yr26" "yr27"
[66] "yr28"...
More information about the R-help
mailing list