[R] Hmisc: can not reproduce figure 4 of Statistical Tables and Plots using S and LATEX
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Sun Nov 25 16:56:32 CET 2007
John Smith wrote:
> Dear R-users:
>
> I can not reproduce figure 4 of *Statistical Tables and Plots using S and
> LATEX* by Prof. Frank Harrell with the following code:
>
> rm(list=ls())
> library(Hmisc)
>
> getHdata(pbc)
> attach(pbc)
> age.groups <- cut2(age, c(45,60))
> g <- function(y) apply(y, 2, quantile, c(.25,.5,.75))
> y <- with(pbc, cbind(Chol=chol,Bili=bili))
> # You can give new column names that are not legal S names
> # by enclosing them in quotes, e.g. 'Chol (mg/dl)'=chol
> vars <- with(pbc, c(label(chol), label(bili)))
> label(y) <- paste(vars, collapse=' and ') # Will make nice caption in table
> s3 <- summary(y ~ age.groups + ascites, fun=g, data=pbc)
> s3
>
> windows(width=10.67, height=6.60)
> par(mfrow=c(1,2), oma=c(3,0,3,0))
> for(ivar in 1:2)
> {
> isub <- (1:3)+(ivar-1)*3
> print(isub)
> plot(s3, which=isub, main='', xlab=vars[ivar], pch=c(91,16,93))
Add ,reset.par=FALSE before the final ) above. This will be correct in
the next version of the document.
Next time please follow the posting guide with regard to specifying
information about the version of R, platform, and the description of the
problem you encountered.
Note that you did reproduce the code in the document exactly as it
produced a pdf file, not an on-screen graphic.
Frank
> }
> mtitle(paste('Quartiles of', label(y)), cex.m=1.5)
>
>
> Could any one help me?
>
> Thanks
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list