[R] Fw: na.rm problem

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Aug 1 10:19:00 CEST 2006


sonal at deepfoo.com wrote:
> hi,
> 
> i am a new member.
> 
> i am using R in finding correlation between two variables of unequal length.
> 
> when i use
> 
> cor(x,y,na.rm=T,use="complete")
> 
> where x has observations from 1928 to 2006 & y has observations from 1950 to
> 2006. I used na.rm=T to use the "complete observations".  So missing values
> should be handled by casewise deletion. But it gives me error
> 
> Error in cor(close, close1, na.rm = T, use = "complete") : 
>         unused argument(s) (na.rm ...)
> 
> Please help me with this as I am new to R.


See ?cor. It does not have an na.rm argument. Just use:

   cor(x, y, use = "complete")

Uwe Ligges


> Thanks,
> Sonal
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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