[R] Problems using hetcor (polycor)

John Fox jfox at mcmaster.ca
Thu Aug 7 15:03:21 CEST 2008


Dear Birgit,

Without looking at your data, it seems clear from the warning messages that when all of the observations with missing data are excluded, at least one of the variables becomes invariant. You can simply check this for yourself: Filter out the missing data, TestPart <- na.omit(TestPart), and then look at the distribution of each variable.

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Mark Difford
> Sent: August-07-08 7:23 AM
> To: r-help at r-project.org
> Subject: Re: [R] Problems using hetcor (polycor)
> 
> 
> Hi Birgitle,
> 
> You need to get this right if someone is going to spend their time helping
> you. Your code doesn't work: You have specified more columns in colClasses
> than you have in the provided data set.
> 
> > TestPart<-read.table("TestPart.txt", header=TRUE,row.names=1,
> > na.strings="NA" ,colClasses = Classe81)
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> :
>   line 1 did not have 82 elements
> 
> > TestPart<-read.table("TestPart.txt", header=TRUE,row.names=1,
> > na.strings="NA")
> Warning message:
> In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
>   number of items read is not a multiple of the number of columns
> 
> > length(names(TestPart))
> [1] 72
> 
> > length(Classe81)
> [1] 82
> 
> That will never work.
> 
> HTH, Mark.
> 
> 
> Birgitle wrote:
> >
> > Sorry if this post should be long but I tried to give you a piece of my
> > data to reproduce my error message using hetcor:
> >
> > Fehler in result$rho : $ operator is invalid for atomic vectors
> > Zusätzlich: Warning messages:
> > 1: In polychor(x, y, ML = ML, std.err = std.err) :
> >   1 row with zero marginal removed
> > 2: In polychor(x, y, ML = ML, std.err = std.err) :
> >   the table has fewer than 2 rows
> >
> >
> > Error in result$rho : $ operator is invalid for atomic vectors
> > Additional: Warning message:
> > 1: In polychor(x, y, ML = ML, std.err = std.err) :
> >   1 row with zero marginal removed
> > 2: In polychor(x, y, ML = ML, std.err = std.err) :
> >   the table has fewer than 2 rows
> >
> > Use tab delimited data at the end of the post.
> > Copy in Texteditor and save as TestPart.txt
> >
> > Then use the following code
> >
> > library(methods)
> > setClass("of")
> > setAs("character", "of", function(from) as.ordered(from))
> >
> > Classe81<-cclasses <- c(rep("factor", 64),  rep("numeric",6), rep ("of",
> > 12))
> >
> > TestPart<-read.table("TestPart.txt", header=TRUE,row.names=1,
> > na.strings="NA" ,colClasses = Classe81)
> >
> > str(TestPart)
> >
> > library(polycor)
> >
> > TestPart.hetcor<-hetcor(TestPart, use="complete.obs")
> >
> > this will produce the above mentioned error message that I can not
> > interprete.
> >
> > Would be great if somebody could help me to solve the problem.
> >
> > Thanks
> >
> > B.
> >

. . .

> >
> >
> 
> --
> View this message in context: http://www.nabble.com/Problems-using-hetcor-
> %28polycor%29-tp18867343p18868284.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list