hi brennan, survey design objects can be subsetted with the same subset()
syntax as data.frame objects, so following jeff's advice maybe you want

svyglm( formula , design = subset( surveydesign , variable %in% c( 'value
a' , 'value b' ) ) )

for some examples of how to construct a survey design with public use data,
see http://github.com/ajdamico/usgsd


On Wed, Feb 11, 2015 at 11:49 PM, Jeff Newmiller <jdnew...@dcn.davis.ca.us>
wrote:

> This seems like a fundamental  misunderstanding on your part of how
> operators, and in particular logical expressions, work in computer
> languages. Consider some examples:
>
> 1+2 has a numeric answer because 1 and 2 are both numeric.
> 1+"a" has at the very least not a numeric answer because the values on
> either side of the "+" sign are not both numeric.
> TRUE | FALSE  has a logical type of answer because both sides of the
> logical "or" operator are logical.
> However, you are expressing something like
> TRUE | "a string" which might mean something but that something generally
> is not a logical type of answer.
>
> Try
> variable=="value a" | variable=="value b"
> or
> variable %in% c( "value a", "value b" )
>
> You would probably find that the Introduction to R document that comes
> with R has some enlightening examples in it. You might also find Pat Burns'
> "The R Inferno" entertaining as well (search for it in your favorite search
> engine).
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
> Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On February 11, 2015 8:42:58 PM EST, Brennan O'Banion <
> brennan.oban...@gmail.com> wrote:
> >I am aware that it is possible to specify a subset with a single
> >logical operator when constructing a model, such as:
> >svyglm(formula, design=data, subset=variable=="value").
> >
> >What I can't figure out is how to specify a subset with two or more
> >logical operators:
> >svyglm(formula, design=data, subset=variable=="value a"|"value b").
> >
> >Is it possible to specify a subset in this way using *glm without
> >having to, in my case, subset the original data, create a survey
> >design, and then fit a model?
> >
> >______________________________________________
> >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to