I am having problems with NULL values. I understand in R one can
command the program to skip null values.
Can some one help me on the command line for that.
Do i enter is as part of the string in:
a<- read.table("filename.csv", header = T, row.names=1, sep=",");
My problem is largely when i attempt to use correlation for my data...
xcc <- cor(a);
The error i get is as follows
Error in cor(a) : missing observations in cov/cor
In addition: Warning message:
In cor(a) : NAs introduced by coercion
Regards
Paul Murima
______________________________________________
R-h...@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.
x=c(1,2,3,4,5,NA)
y=c(2,3,3.5,4.75,NA,7)
z=c(5,8,7,6,NA,11)
a=data.frame(x,y,z)
cor(a)
cor(a,use="c")
cor(a,use="p")
Cheers,
Daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Ursprüngliche Nachricht-----
Von: r-help-...@r-project.org [mailto:r-help-...@r-project.org] Im
Auftrag von paul murima
Gesendet: Tuesday, December 02, 2008 11:33 PM
An: r-h...@r-project.org
Cc: r-h...@stat.math.ethz.ch
Betreff: [R] Null values In R.
paul murima wrote:
>
>
> My problem is largely when i attempt to use correlation for my data...
> xcc <- cor(a);
>
> The error i get is as follows
>
> Error in cor(a) : missing observations in cov/cor
>
As Daniel suggested, it is always best to use the function's parameter to
handle NULLs. In other cases, it could help to do
a <- na.omit(a)
but be careful: this may throw away to many rows when you have more than 2
columns.
Dieter
--
View this message in context: http://www.nabble.com/Null-values-In-R.-tp20806622p20807696.html
Sent from the R help mailing list archive at Nabble.com.