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. jess -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, channelheader <- "CHH" # you need to define it rm (c (channelheader, paste ("channel", 1:3, sep=""))) gives an error, but rm (list=c (channelheader, paste ("channel", 1:3, sep=""))) should remove objects CHH, channel1, channel2, channel3 It is possible to list objects using regexp (a generalisation of wildcards, look ?grep). E.g. you may write objs <- ls(pattern="^channel[1-3]") rm(list=c(channelhead, objs)) in order to achive the same result as above. Perhaps it helps Ott | From: "Balint, Jess" <JBalint at alldata.net> | Date: Mon, 18 Nov 2002 14:20:21 -0500 | | 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? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Jess Balint wrote:>Hello all. I have two small questions in one post, for the sake ofbrevity.> >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 itout. 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 lastcharacter?> >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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
R1.61, WinNT Dear listers - I am trying to implement the SPLUS example for boostrapping coefficients from a linear model - boot(data.frame, coef(eval(model$call))) I get errors saying that my statistic is not defined and that the replicates are not defined. Changing this to - boot(recTTM, statisitic=coef(eval(mod$call)),R=999) still gives the error about the statistic. Clearly I do not understand what the statisitic is and how to make the coefficients a function as in the examples in the help... can someone guide me on syntax? cheers andrew ---------------------------------------------------------- Dr. Andrew Beckerman Institute of Biological Science University of Stirling Stirling FK9 4LA +44 (0)1786 then wk-467808 fx-464994 (APB is not responsible for anything below this) -- The University of Stirling is a university established in Scotland by charter at Stirling, FK9 4LA. Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not disclose, copy or deliver this message to anyone and any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of the University of Stirling shall be understood as neither given nor endorsed by it. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi,> R1.61, WinNT > > Dear listers - I am trying to implement the SPLUS example for boostrapping > coefficients from a linear model - > > boot(data.frame, coef(eval(model$call))) > > I get errors saying that my statistic is not defined and that the > replicates are not defined. Changing this to - > > boot(recTTM, statisitic=coef(eval(mod$call)),R=999) > > still gives the error about the statistic. Clearly I do not understand > what the statisitic is and how to make the coefficients a function as in > the examples in the help... can someone guide me on syntax? >Try ?boot. There are some examples and good explanation of arguments boot function needs. As for a simple explanation, in your case (with default parameters) statistic must be a function of two arguments, first argument the data, and second the vector of indices which define the bootstrap sample. For example let us say that our data is my.data, and we want to bootstrap linear regression coefficients, where dependent variable is the first column of my.data, and independent variables are the rest columns of my.data. Then the call to boot function would be boot(my.data,statistic=boot.fun,R=999), where boot.fun <- function(data,ind) { coef(lsfit(data[ind,-1],data[ind,1],intercept=TRUE)) #Note: we could use the lm, but if we only need the regression #coefficients, lsfit is faster } Hope it helps Vaidotas Zemlys -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear Andrew, My R and S-PLUS Companion has an on-line appendix on bootstrapping regression models that might be of help. You can find it (and other appendices) at <http://www.socsci.mcmaster.ca/jfox/Books/Companion/appendix.html>. I hope that this answers your questions. John At 02:17 PM 11/20/2002 +0000, Andrew Beckerman wrote:>R1.61, WinNT > >Dear listers - I am trying to implement the SPLUS example for boostrapping >coefficients from a linear model - > >boot(data.frame, coef(eval(model$call))) > >I get errors saying that my statistic is not defined and that the >replicates are not defined. Changing this to - > >boot(recTTM, statisitic=coef(eval(mod$call)),R=999) > >still gives the error about the statistic. Clearly I do not understand >what the statisitic is and how to make the coefficients a function as in >the examples in the help... can someone guide me on syntax? > >cheers >andrew >---------------------------------------------------------- >Dr. Andrew Beckerman >Institute of Biological Science >University of Stirling >Stirling FK9 4LA >+44 (0)1786 then wk-467808 fx-464994 >(APB is not responsible for anything below this) > >-- >The University of Stirling is a university established in Scotland by >charter at Stirling, FK9 4LA. Privileged/Confidential Information may >be contained in this message. If you are not the addressee indicated >in this message (or responsible for delivery of the message to such >person), you may not disclose, copy or deliver this message to anyone >and any action taken or omitted to be taken in reliance on it, is >prohibited and may be unlawful. In such case, you should destroy this >message and kindly notify the sender by reply email. Please advise >immediately if you or your employer do not consent to Internet email >for messages of this kind. Opinions, conclusions and other >information in this message that do not relate to the official >business of the University of Stirling shall be understood as neither >given nor endorsed by it. > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._____________________________ John Fox Department of Sociology McMaster University email: jfox at mcmaster.ca web: http://www.socsci.mcmaster.ca/jfox ____________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._