[R] need help creating means table

David White dwhite at ling.ohio-state.edu
Mon Sep 24 19:24:08 CEST 2001


Peter Delgaard wrote:
%
%How about
%
%nums <- sapply(xx, is.numeric)
%by(xx[nums], list(subjs, cons, vowels), mean)
%
%?
%

Thanks Peter, that gets me around the error message, but it return only
one value per subjs x vowels x cons combination, I need a separate mean
for each of the fix numeric columns.

Best,

D

S. David White
sdavidwhite at bigfoot.com
Columbus, Ohio

On 24 Sep 2001, Peter Dalgaard BSA wrote:

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



More information about the R-help mailing list