[R] Pointer to covariates?

Thomas Lumley tlumley at u.washington.edu
Thu Feb 21 17:33:58 CET 2002


On Thu, 21 Feb 2002, Anne York wrote:

> Here is another idea, but the overhead might be just as great.
>
> dat_data.frame(y=1:3,x1=c(1,0,1),x2=c(0,1,0))
> dat.unique_unique(paste(as.character(dat$x1),as.character(dat$x2)))
> dat.keys_match(paste(as.character(dat$x1),as.character(dat$x2)),dat.unique)
>
>

The overhead should be quite small: unique() and match() both use a
hashing algorithm that should give total time and space linear in the
number of data rows (unlike the quadratic time and space needed for the
dist() solution).


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	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