Thanks very much, John. This is very helpful. Burnette
From: John Kane [via R] [mailto:ml-node+s789695n4669297...@n4.nabble.com] Sent: Tuesday, June 11, 2013 5:35 PM To: Crombie, Burnette N Subject: Re: assigning global columns selection for all subset functions in script index the columns to select lets say you want to select a set of colmns 2,4,6,8 Try something like this. (not run) mycols <- c(2,4,6,8) select(mydata[ , mycols] , mdata$x == 3) John Kane Kingston ON Canada > -----Original Message----- > From: [hidden email]</user/SendEmail.jtp?type=node&node=4669297&i=0> > Sent: Tue, 11 Jun 2013 09:18:25 -0700 (PDT) > To: [hidden email]</user/SendEmail.jtp?type=node&node=4669297&i=1> > Subject: [R] assigning global columns selection for all subset functions > in script > > How do I let R know that I always want to select the same columns in my > subset functions (below), so that I don't have to keep copy/pasting the > same > selection? (thanks) > devUni2 <- subset(devUni1, dind02 != 52, > select=c(paidhre,earnhre,earnwke,uhourse,hourslw,otc,ind02,dind02,occ00,docc00,lfsr94,class94,relref95,smsastat,state,weight,year)) > devUni3 <- subset(devUni2, lfsr94 == 1 | lfsr94 == 2 , > select=c(paidhre,earnhre,earnwke,uhourse,hourslw,otc,ind02,dind02,occ00,docc00,lfsr94,class94,relref95,smsastat,state,weight,year)) > devUni4 <- subset(devUni3, class94 < 6 , > select=c(paidhre,earnhre,earnwke,uhourse,hourslw,otc,ind02,dind02,occ00,docc00,lfsr94,class94,relref95,smsastat,state,weight,year)) > devUni5 <- subset(devUni4, relref95 < 10 | relref95 ==13 | relref95 > >=14, > select=c(paidhre,earnhre,earnwke,uhourse,hourslw,otc,ind02,dind02,occ00,docc00,lfsr94,class94,relref95,smsastat,state,weight,year)) > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/assigning-global-columns-selection-for-all-subset-functions-in-script-tp4669252.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email]</user/SendEmail.jtp?type=node&node=4669297&i=2> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ____________________________________________________________ ______________________________________________ [hidden email]</user/SendEmail.jtp?type=node&node=4669297&i=3> mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ________________________________ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/assigning-global-columns-selection-for-all-subset-functions-in-script-tp4669252p4669297.html To unsubscribe from assigning global columns selection for all subset functions in script, click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4669252&code=YmNyb21iaWVAdXRrLmVkdXw0NjY5MjUyfC0xMzI5MzM0NzI3>. NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://r.789695.n4.nabble.com/assigning-global-columns-selection-for-all-subset-functions-in-script-tp4669252p4669343.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.