Hi all,
Is there any way to remove at the same time several variables that share
a suffix, for example (similar to * or ? in DOS) ?
Thanks in advance,
Aurora
Removing variables
5 messages · Aurora Torrente, Chuck Cleland, Spencer Graves +2 more
Aurora Torrente wrote:
Is there any way to remove at the same time several variables that share a suffix, for example (similar to * or ? in DOS) ?
To remove objects sharing a suffix use something like:
remove(list=objects(pattern="SUFFIX$"))
To remove variables sharing a suffix from a dataframe use
something like:
newdata <- mydata[,-grep("SUFFIX$", names(mydata))]
In both cases the $ metacharacter indicates that the literal
characters are at the end of the string.
hope this helps,
Chuck Cleland
x1 <- 1
> y1 <- 1 > objects(pattern="*1") [1] "x1" "y1" > remove(list=objects(pattern="*1")) > objects(pattern="*1") character(0) Hope this helps. spencer graves
Aurora Torrente wrote:
Hi all,
Is there any way to remove at the same time several variables that share
a suffix, for example (similar to * or ? in DOS) ?
Thanks in advance,
Aurora
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Hi, is there a package for performing leave-one-out cross validation in R?
help.search("cross validation") returns 'cv.glm(boot)'
and the boot package provides many other utilities for this.
- tom blackwell - u michigan medical school - ann arbor -
On Thu, 14 Aug 2003, array chip wrote:
Hi, is there a package for performing leave-one-out cross validation in R?
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help