Thanks, David.  I appreciate your help.  Your solution is the idea I also had but wasn't quite sure if it was allowed in this case.  That's a simple fix.

Burnette

From: David Winsemius [via R] [mailto:ml-node+s789695n4669295h57@n4.nabble.com]
Sent: Tuesday, June 11, 2013 5:31 PM
To: Crombie, Burnette N
Subject: Re: assigning global columns selection for all subset functions in script


On Jun 11, 2013, at 9:18 AM, bcrombie wrote:

> 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))

Perhaps:

        devUni3 <- subset(devUni2, lfsr94 == 1 | lfsr94 == 2 ,
select=names(devUni2) )

Or just create a character vector:

desired <- names(devUni2)
devUni3 <- subset(devUni2, lfsr94 == 1 | lfsr94 == 2 , select=desired )

Because I am lazy I exprimented a bit to avoid adding all those quote marks:

desired <- expression(paidhre, earnhre,earnwke,uhourse,hourslw,otc,ind02, dind02,occ00,docc00,lfsr94,class94,relref95,smsastat,state,weight,year)

as.character(as.list(desired))
 [1] "paidhre"  "earnhre"  "earnwke"  "uhourse"  "hourslw"  "otc"      "ind02"
 [8] "dind02"   "occ00"    "docc00"   "lfsr94"   "class94"  "relref95" "smsastat"
[15] "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))
>

--

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email]</user/SendEmail.jtp?type=node&node=4669295&i=0> 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-tp4669252p4669295.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-tp4669252p4669345.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

