i have a loop inside of which i am selecting elements from a list i am wondering if once the points are selected there is a way to remove the element from the list, not reduce it to zero, but actually remove the element from the list this is probably an easy question that i am just missing, but anywho... any assistance would be greatly appreciated -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
x[[i]] <- NULL jimi adams wrote:> > i have a loop inside of which i am selecting elements from a list > i am wondering if once the points are selected there is a way to remove > the element from the list, not reduce it to zero, but actually remove > the element from the list > > this is probably an easy question that i am just missing, but anywho... > > any assistance would be greatly appreciated > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- Mag. David Meyer Wiedner Hauptstrasse 8-10 Vienna University of Technology A-1040 Vienna/AUSTRIA Department for Tel.: (+431) 58801/10772 Statistics and Probability Theory mail: david.meyer at ci.tuwien.ac.at -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
jimi adams wrote:> > i have a loop inside of which i am selecting elements from a list > i am wondering if once the points are selected there is a way to remove > the element from the list, not reduce it to zero, but actually remove > the element from the list > > this is probably an easy question that i am just missing, but anywho... > > any assistance would be greatly appreciatedmy.list$my.element <- NULL Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Set the list element to NULL. e.g.: a <- as.list(1:10) for (i in 1:9) { j <- sample(1:length(a),size=1) a[[j]] <- NULL print(as.numeric(a)) } On Mon, 11 Feb 2002, jimi adams wrote:> i have a loop inside of which i am selecting elements from a list > i am wondering if once the points are selected there is a way to remove > the element from the list, not reduce it to zero, but actually remove > the element from the list > > this is probably an easy question that i am just missing, but anywho... > > any assistance would be greatly appreciated > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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, just use> list$element <- NULLor> list[[index]] <- NULLbest wishes, Ott Toomet P.S. I do not know whether it is momory and speed-efficient. On Mon, 11 Feb 2002, jimi adams wrote:> i have a loop inside of which i am selecting elements from a list > i am wondering if once the points are selected there is a way to remove > the element from the list, not reduce it to zero, but actually remove > the element from the list > > this is probably an easy question that i am just missing, but anywho... > > any assistance would be greatly appreciated > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, Feb 11, 2002 at 09:45:01AM -0500, jimi adams wrote:> i have a loop inside of which i am selecting elements from a list > i am wondering if once the points are selected there is a way to remove > the element from the list, not reduce it to zero, but actually remove > the element from the listList indecies are one way to do it...> aa<-list(foo=c(1,2,3),bar=c(5:10),baz=rep("hi",6)) > aa$foo [1] 1 2 3 $bar [1] 5 6 7 8 9 10 $baz [1] "hi" "hi" "hi" "hi" "hi" "hi"> bb<-aa[-2] > bb$foo [1] 1 2 3 $baz [1] "hi" "hi" "hi" "hi" "hi" "hi" Any others? Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._