Robin Gruna
2004-Jul-02 13:41 UTC
[R] Error:length of dimnames [2] not equal to array extent ?
Hi everyone, I have the following problem: I want to perform a LDA with the function lda(). My data object mat.data is a matrix with dimensions> dim(mat.data)[1] 1228 44 and my grouping vector grp has length 1228:> length(grp)[1] 1228 Every time I call lda(), the following error message occurs:> lda(mat.data,grp)Error in lda.default(x, grouping, ...) : length of dimnames [2] not equal to array extent In order to find the error I created a matrix mat.test mat.test<-matrix(1:500,nrow=1228,ncol=44) with arbitrary entries an the same attributes as mat.data:> dimnames(mat.test)NULL> dimnames(mat.data)NULL But with the test object mat.test there occurs no error ! Can somebody help me, this really makes me crazy, thanks, Robin
Robin Gruna
2004-Jul-02 14:38 UTC
[R] Error:length of dimnames [2] not equal to array extent ?
Hi everyone, I have the following problem: I want to perform a LDA with the function lda(). My data object mat.data is a matrix with dimensions> dim(mat.data)[1] 1228 44 and my grouping vector grp has length 1228:> length(grp)[1] 1228 Every time I call lda(), the following error message occurs:> lda(mat.data,grp)Error in lda.default(x, grouping, ...) : length of dimnames [2] not equal to array extent In order to find the error I created a matrix mat.test mat.test<-matrix(1:500,nrow=1228,ncol=44) with arbitrary entries an the same attributes as mat.data:> dimnames(mat.test)NULL> dimnames(mat.data)NULL But with the test object mat.test there occurs no error ! Can somebody help me, this really makes me crazy, thanks, Robin
Prof Brian Ripley
2004-Jul-02 15:22 UTC
[R] Error:length of dimnames [2] not equal to array extent ?
Please use the debugging facilities to investigate further -- you have not even shown the traceback, let alone used dump.frames and the debugger. On Fri, 2 Jul 2004, Robin Gruna wrote:> Hi everyone, > I have the following problem: > I want to perform a LDA with the function lda(). > My data object mat.data is a matrix with dimensions > > > dim(mat.data) > [1] 1228 44 > > and my grouping vector grp has length 1228: > > > length(grp) > [1] 1228 > > Every time I call lda(), the following error message occurs: > > > lda(mat.data,grp) > Error in lda.default(x, grouping, ...) : length of dimnames [2] not equal to > array extentdimnames [2] are the column names. That's an error in dimnames<-.> In order to find the error I created a matrix mat.test > > mat.test<-matrix(1:500,nrow=1228,ncol=44) > > with arbitrary entries an the same attributes as mat.data: > > > dimnames(mat.test) > NULL > > > dimnames(mat.data) > NULL > > But with the test object mat.test there occurs no error ! > Can somebody help me, this really makes me crazy, > thanks,Learning to debug R will alleviate the symptoms. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Maybe Matching Threads
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- readDGE: Error in colnames/length of dimnames not equal to array extent
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot