[R] (no subject)

Mulholland, Tom Tom.Mulholland at dpi.wa.gov.au
Thu Mar 17 07:24:47 CET 2005


type ?cor and read the help file

In particular read it till you find the entry that tells you how to deal with missing observations. You need to do this because as you get more competent you will undoubdtedly come across other issues, so learning the format of the help and realising why you need to check the Arguments section will reduce your frustration in the future.

You also need to read the posting guide to make sure that you don't put people offside by failing to follow a basic set of standards which include giving a decent description of your problem in the subject of your message.

cor(x, y = NULL, use = "all.obs",
          method = c("pearson", "kendall", "spearman"))

use is the appropriate argument. All you need to do is to decide which option to wish to use.

Tom

> -----Original Message-----
> From: Brett Stansfield [mailto:brett at hbrc.govt.nz]
> Sent: Thursday, 17 March 2005 5:55 AM
> To: R help (E-mail)
> Subject: [R] (no subject)
> 
> 
> Dear R
> I'm trying to do a correlation matrix for some variables I have.
> Unfortunately there are some NA entries for some of the variables 
> I tried the following
> 
> cor(sleep[c("logbw", "logbrw", "SlowSleep", "ParaSleep", "loglife",
> "loggest")])
> 
> but it told me
> Error in cor(sleep[c("logbw", "logbrw", "SlowSleep", 
> "ParaSleep", "loglife",
> : 
>         missing observations in cov/cor
> 
> How can I get R to conduct a correlation matrix for this data set??
> 
> brett
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list