Dear Anthony, Yes, I can follow the example code you have given. But, do you know from the code shown below (following Thomas Lumley's "Complex Surveys") why I am getting the boxplot of dthage for just xspd=1, not xspd2=2?
My intent is the make this code work so that I can generate similar plots on other continuous variable. Any help will be appreciated. Thanks, Pradip #################### nhis <- svydesign (id=~psu, strat=~stratum, weights=~wt8, data=tor, nest=TRUE) svyboxplot (dthage~xspd2, subset (nhis, mortstat==1), col="gray80", varwidth=TRUE, ylab="Age at Death", xlab="SPD Status: 1-SPD, 2=No SPD") Pradip K. Muhuri, PhD Statistician Substance Abuse & Mental Health Services Administration The Center for Behavioral Health Statistics and Quality Division of Population Surveys 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 e-mail: pradip.muh...@samhsa.hhs.gov<mailto:pradip.muh...@samhsa.hhs.gov> The Center for Behavioral Health Statistics and Quality your feedback. Please click on the following link to complete a brief customer survey: http://cbhsqsurvey.samhsa.gov<http://cbhsqsurvey.samhsa.gov/> From: Anthony Damico [mailto:ajdam...@gmail.com] Sent: Monday, October 01, 2012 10:07 AM To: Muhuri, Pradip (SAMHSA/CBHSQ) Cc: R help Subject: Re: [R] svyboxplot - library (survey) using a slight modification of the example shown in ?svyboxplot # load survey library library(survey) # load example data data(api) # create an example svydesign dstrat <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, fpc = ~fpc) # set the plot window to display 1 plot x 2 plots par(mfrow=c(1,2)) # generate two example boxplots svyboxplot(enroll~stype,dstrat,all.outliers=TRUE) svyboxplot(enroll~1,dstrat) # done # alternative: not as nice # set the plot window to display 2 plots x 1 plot par(mfrow=c(2,1)) # generate two example boxplots svyboxplot(enroll~stype,dstrat,all.outliers=TRUE) svyboxplot(enroll~1,dstrat) # done On Mon, Oct 1, 2012 at 9:50 AM, Muhuri, Pradip (SAMHSA/CBHSQ) <pradip.muh...@samhsa.hhs.gov<mailto:pradip.muh...@samhsa.hhs.gov>> wrote: Hello, I have used the library (survey) package for boxplots using the following code. Could anyone please tell me why I am getting only 1 boxplot instead of 2 boxplots (1-SPD, 2-No SPD). What changes in the following code would be required to get 2 boxplots in the same plot frame? Thanks, Pradip ################################################### nhis <- svydesign (id=~psu, strat=~stratum, weights=~wt8, data=tor, nest=TRUE) svyboxplot (dthage~xspd2, subset (nhis, mortstat==1), col="gray80", varwidth=TRUE, ylab="Age at Death", xlab="SPD Status: 1-SPD, 2=No SPD") Pradip K. Muhuri Statistician Substance Abuse & Mental Health Services Administration The Center for Behavioral Health Statistics and Quality Division of Population Surveys 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 e-mail: pradip.muh...@samhsa.hhs.gov<mailto:pradip.muh...@samhsa.hhs.gov> The Center for Behavioral Health Statistics and Quality your feedback. Please click on the following link to complete a brief customer survey: http://cbhsqsurvey.samhsa.gov vide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org<mailto: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. [[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.