Message-ID: <1336503969081-4618379.post@n4.nabble.com>
Date: 2012-05-08T19:06:09Z
From: york8866
Subject: Help "deleting negative values in a matrix, and do statistic analysis"
In-Reply-To: <1336501320796-4618267.post@n4.nabble.com>
Sorry, my mistake.
it works very well!!!
thanks,
Rui Barradas wrote
>
> Hello,
>
>
> york8866 wrote
>>
>> Hi, John,
>>
>> the code ran well.
>>
>> however, somehow, the means were not calculated correctly using the
>> following code.
>>
>> test <- read.csv("Rtestdataset.csv", as.is=T,header=T)
>> test <- data.frame(test)
>> test
>> rowMeans(test)
>> apply(test,1,function(y)mean(y>=0))
>>
>> Is there anything wrong?
>> thanks,
>>
>
> Yes!!!
>
> It's mean( y[y >= 0] )
>
> Rui Barradas
>
--
View this message in context: http://r.789695.n4.nabble.com/Help-deleting-negative-values-in-a-matrix-and-do-statistic-analysis-tp4617792p4618379.html
Sent from the R help mailing list archive at Nabble.com.