Re: [R] How to get multiple Correlation Coefficients

From: David Barron <mothsailor_at_googlemail.com>
Date: Thu 19 Oct 2006 - 10:53:37 GMT

The problem is that in the expression polychor(vars[i], vars[j]), vars[i] and vars[j] refer to the names of the variables, not the variables themselves. So, use sdi[,i] and sdi[,j] instead.

On 19/10/06, Kum-Hoe Hwang <phdhwang@gmail.com> wrote:
> Hi
>
> I have used a polycor package for categorical correlation coefficients.
> I run the following script. But there were no results.
>
> Could you tell me how to correct the script?
>
> Thanks in advance,
>
> vars <- names(sdi)
> for (i in 1:length(vars)) {
> for (j in 1:length(vars)) {
> paste(vars[i]," and ", vars[j])
> polychor(vars[i], vars[j])
> # corr
> }
> }
>
>
>
> --
> Kum-Hoe Hwang, Ph.D.Phone : 82-31-250-3516Email : phdhwang@gmail.com
>
> ______________________________________________
> R-help@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.
>

-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

______________________________________________
R-help@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.
Received on Fri Oct 20 07:44:59 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 22:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.