[R] Re : Sort out number on value

Petr PIKAL petr.pikal at precheza.cz
Fri Apr 20 15:19:08 CEST 2012


Hi

Without data it is only a guess.
> 
> I found out something strange when I used the same thing on another data
> file. 
> 
> In a excel file I have same data too and there I asked in a certain 
column
> what values where above the 7.5. Result: 206. 
> Now I have done the same thing in R and I get as result: 400. 

I was tempted to assign it to FAQ 7.31 about finite precision of decimals. 
However such a big difference is rather strange.

> 
> My code: 
> # Find values above 7.5. 
> C = x[x => 7.5]
> 
> # Calculate length. 
> number = length[C]

Shouldn't it be length(C)? 

> 
> # print outcome
> number 

I personally suspect NA values which are retained after subsetting. Output 
from

str(your object)

could help.

Maybe you want only number of values. For that you shall to use

sum(!is.na(C))

But maybe I am on a wrong track.

Regards
Petr


> 
> Or could it have something to do that I have calculated the log2 value 
from
> a value dat was like: 7.84394 -01 However I don't think that was the 
problem
> since I cheaked the first 10 log2 values, and they where correct. 
> 
> I just don't understand why the answer is now higer, 400 and not 
206..... 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Sort-out-
> number-on-value-tp4573467p4573764.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list