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,he
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
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,
--
View
It looks fine to me. Why do you say it does not work?
Any error messages?
John Kane
Kingston ON Canada
> -Original Message-
> From: yu_y...@hotmail.com
> Sent: Tue, 8 May 2012 10:06:07 -0700 (PDT)
> To: r-help@r-project.org
> Subject: Re: [R] Help "deleting negativ
Hi, Rui,
I tried your code. It did not work.
thanks,
--
View this message in context:
http://r.789695.n4.nabble.com/Help-deleting-negative-values-in-a-matrix-and-do-statistic-analysis-tp4617792p4618080.html
Sent from the R help mailing list archive at Nabble.com.
_
Hello,
Try
(x is your matrix)
rowMeans(x)
apply(x, 1, function(y) mean( y[y >= 0] ))
Hope this helps,
Rui Barradas
york8866 wrote
>
> Dear all,
>
> I have encountered a problem with such a dataset:
>
> 1 52 2 5 2 6
> 1523 2 1 3 3
> 2
6 matches
Mail list logo