Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.44.0202210831250.72740-100000@homer37.u.washington.edu>
Date: 2002-02-21T16:33:58Z
From: Thomas Lumley
Subject: Pointer to covariates?
In-Reply-To: <Pine.GSO.4.05.10202210736170.27487-100000@ofis450a.akctr.noaa.gov>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._