Skip to content

hairy indexing problem

1 message · Bill Venables

#
[WNV]  I think there could be a better way.  

	Make sure subject is a factor:

		subject <- as.factor(data$subject)

	and then your "replications class" factor is

		reps <- factor(table(subject)[subject])

	The next step could be 

		fooMeans <- tapply(data$foo, reps, mean)
[WNV]  Yep, that too.   gsummary is part of the nlme package which
has to be loaded.
[WNV]  Bill.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._