[R] How to get multiple Correlation Coefficients

David Barron mothsailor at googlemail.com
Thu Oct 19 13:04:42 CEST 2006


Oh, and of course you need to use an explicit print inside a for loop.
 So, the line would be:

>  print( polychor(sdi[,i], sdi[,j]))

On 19/10/06, David Barron <mothsailor at googlemail.com> wrote:
> 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 at 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 at gmail.com
> >
> > ______________________________________________
> > 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.
> >
>
>
> --
> =================================
> David Barron
> Said Business School
> University of Oxford
> Park End Street
> Oxford OX1 1HP
>


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



More information about the R-help mailing list