[EMAIL PROTECTED] wrote:
Hello,
following functions doesnt work correct with my data: median(),
geo.mean().
My datafiles contain more than 10.000 lines and six columns from a
flow-cytometer-measurment. I need the arithmetic and geometric mean
and median. For the calculation of the geometric mean i wrote
following function:
fix(geo.mean)
function(x)
{
n<-length(x)
gm<-prod(x)^(1/n)
This is probably what gives the NaN below.
exp(mean(log(x)))
would be more to the point.
Kjetil
return(gm)
}
The function median() error tells me "need numeric data". The data are
numeric. The function geo.mean() gave out "[1] NaN". What are the
reasons and what are the solutions?
I'am a newbie and need urgently information.
Thanks.
Here is an short output with the results:
9997 385.42 68.54 9.82 124.09 23.93 138.24
9998 342.89 73.65 133.35 1134.19 345.99 1876.88
9999 316.23 76.35 48.26 421.70 129.80 873.79
10000 291.64 103.66 6.85 107.46 26.42 189.38
10001 0.00 0.00 0.00 0.00 0.00 0.00
> mean(data)
FSC SSC FL1 FL2 FL32 FL4
375.94880 73.76219 50.73413 434.42837 110.06393 637.34980
> geo.mean(data)
[1] NaN
> median(data)
Error in median(data) : need numeric data
>
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
-- Mahdi Elmandjra
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html