Jess Balint wrote:
Hello all. I have two small questions in one post, for the sake of
brevity.
1. I have some objects that I want to delete. I have the line:
rm (c (channelheader, paste ("channel", 1:3, sep="")))
I have tried a few variations, including list=, but cannot figure it
out. In
SAS, I can use a ':' as a wildcard. Is there any equivalent in R? 2. Is there any possible was to order data by the second to last
character?
TIA.
1. # to remove all objects whose names starts by "xyz" followed by a digit use:
remove(list=ls(pattern="^xyz[0-9]"))
See: -> help(ls) -> use of argument "pattern" -> regular expressions Take care: wild characters / regular expressions are dangerous in removal processes 2. # to sort a vector of strings by the last and the last but one characters
a<-c("asdf","wdftwsertwret","wer","XYCVV")
a[order((substring(a,nchar(a)-1)))]
[1] "XYCVV" "asdf" "wer" "wdftwsertwret"
Peter Wolf -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._