David White <dwhite at ling.ohio-state.edu> writes:
> Hello,
>
> I have been trying to use by to create a means table, but receive the
> error " by(xx, list(subjs, cons, vowels), mean)
> Error in Summary.data.frame(..., na.rm = na.rm) :
> only defined on a data frame with all numeric or complex
> variables" when the data frame consists of three factor columns
(subjs,
> cons and vowels) and 5 numeric data columns.
>
> The output I'm looking for is a simple mean for each of the numeric
> columns by the independent variables subjs, vowel, consonant.
>
> Thanks for you advice,
How about
nums <- sapply(xx, is.numeric)
by(xx[nums], list(subjs, cons, vowels), mean)
?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._