[R] plot history, libraries, weights

Thomas Lumley thomas at biostat.washington.edu
Mon Sep 4 19:45:44 CEST 2000


On Mon, 4 Sep 2000, Charles Raux wrote:

> 3 general questions:
> 1) How can I have the plot History Recording automatically turned on 
> each time I start R (Windows)?
> 2) How can I have some libraries automatically loaded at R start?

The .Rprofile file is executed at start-up.  Load
the packages there. It's described in the  Windows readme file.
 
> 3) As far as I know weights can be specified only for lm. How can I 
> take account of weights with a weighted sample in other models or 
> functions (table but also other multivariate and cluster techniques)?

Some other functions have weights (eg glm, some survival functions).  Most
don't.  Also, most of the functions that have weights have frequency
weights rather than probability weights: that is, setting a weight equal
to 2 has exactly the same effect as replicating the observation. We don't
have (and IMO do need) facilities for probability weights, where a weight
of 2 means that sampling probability for that unit was half the
probability for a unit with weight 1. 

If you have frequency weights you may have to expand your dataset.

  expanded.data<-as.data.frame(lapply(compressed.data,
                   function(x) rep(x,compressed.data$weights)))

should do it.


	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list