[R] sm.density.compare

Mark Difford mark_difford at yahoo.co.uk
Wed Mar 4 07:02:41 CET 2009


Hi James,

>> Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, 
>> : 
>> missing value where TRUE/FALSE needed ...
>> ... The only difference with my data is that I have some missing values
>> that show as NA

This is precisely the problem.

## Show the error [message]
y <- rnorm(100)
y[c(3,6,9,12,20,56)] <- NA
g <- rep(1:2, rep(50,2))
sm.density.compare(y, g, model="equal")

## One way around the problem is row-wise deletion of NAs
na.omit(cbind.data.frame(y,g))
with(na.omit(cbind.data.frame(y,g)), sm.density.compare(y, g,
model="equal"))

Regards, Mark.


James Lenihan wrote:
> 
> I am running the sm.density.compare function amd I am getting the
> following error:
>  
> my code is  > sm.density.compare(LBSTRESN,COHORT,xlab="Units =
> umol/L"subset = LBTEST=="Creatinine")
>  
> Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, 
> : 
>   missing value where TRUE/FALSE needed
>  
> I do not understand the error and I have had no help when searching the
> WEB or the R documentation.
>  
> I have tried the sample program in the R doc:y <- rnorm(100)
> g <- rep(1:2, rep(50,2))
> sm.density.compare(y, g, model="equal")
>  and it works fine.   The only difference with my data is that I have some
> missing values that show as NA. I have checked that theseare numbered
> values by using the is.nan function. Any ideas? Thank You Jim L. 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/sm.density.compare-tp22318110p22324216.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list