Skip to content
Prev 166886 / 398502 Next

Comparing elements for equality

Hello,

You could build your output dataframe along the following lines:

foo <- function(x) length( unique(x) ) == 1

results <- data.frame(
	freq = tapply( dat$id,   dat$id, length ),
	var1 = tapply( dat$var1, dat$id, foo ),
	var2 = tapply( dat$var2, dat$id, foo )
)

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com
On Tue, 2009-01-13 at 14:17 -0500, Doran, Harold wrote: