[R] Error in var(x, na.rm = na.rm) : no complete element pairs

ml-r-help at epigenomics.com ml-r-help at epigenomics.com
Thu Mar 5 19:05:40 CET 2009


Carlos Morales wrote:
> Hello,
> 
> I still have the same error which I have written in the Subject field, I leave here the code and I hope you can help me with this:
> 
[removed]

the lengthy code example does not make it easier to help you, in particular without the
data you used. All the commented out code should have been removed before posting.
My guess is that you use R < 2.8.0 and generate a vector s which contains only NAs.
Try to inspect your function filter.clones by putting a browser()
call somewhere before the sd() call and run it again.
See ?browser and ?trace.

And you could vectorize this (and other parts), e.g.
the last loop would be rewritten as

tripliclones.info$Estandar_desviation <- apply(tripliclones.info[ ,2:4], 1, function(x)
sd(as.numeric(x), na.rm=TRUE))

Regards, Matthias


R version 2.7.1 (2008-06-23)
> b <- rep(NA,4)
> sd(b)
Error in var(x, na.rm = na.rm) : missing observations in cov/cor
> sd(b, TRUE)
Error in var(x, na.rm = na.rm) : no complete element pairs


R version 2.8.1 (2008-12-22)
> b<- rep(NA,4)
> sd(b)
[1] NA
> sd(b, TRUE)
[1] NA

-- 
Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-0                            fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger at epigenomics.com
--
Epigenomics AG Berlin           Amtsgericht Charlottenburg HRB 75861
Vorstand:                           Geert Nygaard (CEO/Vorsitzender)
                                            Oliver Schacht PhD (CFO)
Aufsichtsrat:   Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)




More information about the R-help mailing list