[R] Error in dimnames(phi) <- list(rn, dims) : length of 'dimnames' [2] not equal to array extent

David L Carlson dcarlson at tamu.edu
Mon May 18 16:27:49 CEST 2015


I think this is a bug in the current version of ca() in package ca. I am copying the package maintainer with this example:

# Reproducible example from manual page for ca():

> library(ca)
> data("author")
> author.ca <- ca(author) # No problem
> author.ca <- ca(author, nd=3)
Error in dimnames(phi) <- list(rn, dims) : 
  length of 'dimnames' [2] not equal to array extent
> library(MASS)
> author.ca <- corresp(author, nf=3) # No problem

So the MASS version of correspondence analysis, corresp(), is able to extract three dimensions (actually up to 11) from "author". I am certain I have used ca() in the past and extracted more than two dimensions from similar tables. 

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon
Sent: Sunday, May 17, 2015 7:31 PM
Cc: r-help mailing list
Subject: Re: [R] Error in dimnames(phi) <- list(rn, dims) : length of 'dimnames' [2] not equal to array extent

Hi Yonas,
If this is the "ca" function from the package of the same name, it
looks to me as though your data set is only two dimensions and you are
requesting 3 dimensions in the output. Have you tried calling ca with
the default nd=NA?

Jim


On Mon, May 18, 2015 at 3:22 AM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:
> You desperately need to study [1] and the Posting Guide mentioned at the bottom of this and every other message on this list.
>
> [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On May 17, 2015 7:31:08 AM PDT, Yonas Yohannes <yonas at wku.edu.et> wrote:
>>Dears,
>>I have presence and absence data set (8 rows and 33 columns) and when I
>>want to get out of the default two dimensions command using
>>summary(ca(mydata,
>>nd=3)) the following error message displyed:
>>
>>Error in dimnames(phi) <- list(rn, dims) :
>>  length of 'dimnames' [2] not equal to array extent
>>
>>Please help! So many thanks in advance!
>>Kindly,
>>* <mail%3Ayonas at wku.edu.et>*
>>
>>       [[alternative HTML version deleted]]
>>
>>______________________________________________
>>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>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.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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