[adegenet-forum] Error in spdep::lag.listw(listw, x, TRUE) : object lengths differ

Nevil Amos nevil.amos at gmail.com
Tue May 4 05:30:15 CEST 2010


Thanks for the response, I have repeated with another set of data ( 
different species from the same datasource)

I am still getting the same error
There are no NA values in the coordinates

The code initially reads the data from an MS access database - cannot 
append this, but I have again appended the workspace, and the R: 
commands and output are copied below and the r script attached.

Type 2 and 3 connection networks also result in an error, type 4-7 run OK.

thanks

 > setwd("d:/nevs docs/rwork/test/")
 > library (adegenet)
    ==========================
     adegenet 1.2-3 is loaded
    ==========================

  - to start, type '?adegenet'
  - to browse adegenet website, type 'adegenetWeb()'
  - to post questions/comments: adegenet-forum at lists.r-forge.r-project.org

 > library (RODBC)
 > channel <- odbcConnectAccess("Linkage_fe.mdb")
 > mydata <- sqlFetch(channel, "Toadegenet")
 > n<-ncol(mydata)
 > geno=mydata[,c(7:n)]
 > Site=mydata[,c(1)]
 > BirdID=mydata[,c(2)]
 > XY=mydata[,c(5:6)]
 > mygenind<-df2genind(geno, sep="",  
ind.names=BirdID,ncode=3,pop=Site,loc.names=NULL,   missing=NA, 
ploidy=2, type=c("codom"))
 > mygenind at other$xy<-XY
 > myspca<-spca(mygenind)

Attaching package: 'ade4'


         The following object(s) are masked from package:base :

          within

Loading required package: sp
Loading required package: boot

Attaching package: 'boot'


         The following object(s) are masked from package:survival :

          aml

Loading required package: Matrix
Loading required package: lattice

Attaching package: 'lattice'


         The following object(s) are masked from package:boot :

          melanoma

Loading required package: MASS
Loading required package: nlme
Loading required package: maptools
Loading required package: foreign
Loading required package: deldir
deldir 0.0-12

      Please note: The process for determining duplicated points
      has changed from that used in version 0.0-9 (and previously).

Loading required package: coda
Loading required package: spam
Package 'spam' is loaded. Spam version 0.20-3 (2010-01-13).
Type demo( spam) for some demos, help( Spam) for an overview
of this package.
Help for individual functions is optained by adding the
suffix '.spam' to the function name, e.g. 'help(chol.spam)'.

Attaching package: 'spam'


         The following object(s) are masked from package:Matrix :

          norm


         The following object(s) are masked from package:base :

          backsolve,
          forwardsolve


Attaching package: 'spdep'


         The following object(s) are masked from package:ade4 :

          mstree


Choose a connection network:
          Delaunay triangulation (type 1)
          Gabriel graph (type 2)
          Relative neighbours (type 3)
          Minimum spanning tree (type 4)
          Neighbourhood by distance (type 5)
          K nearest neighbours (type 6)
          Inverse distances (type 7)
Answer: 1

Keep this graph (y/n)? y
Error in spdep::lag.listw(listw, x, TRUE) : object lengths differ
In addition: Warning message:
In spca(mygenind) :
   NAs in data are automatically replaced (to mean allele frequency)
 >
 > myspca<-spca(mygenind)

Choose a connection network:
          Delaunay triangulation (type 1)
          Gabriel graph (type 2)
          Relative neighbours (type 3)
          Minimum spanning tree (type 4)
          Neighbourhood by distance (type 5)
          K nearest neighbours (type 6)
          Inverse distances (type 7)
Answer: 2
Error in gabrielneigh(xy) :
   number of neighbours overrun - increase nnmult


there are no On 4/05/2010 5:39 AM, Jombart, Thibaut wrote:
> Dear Nevil,
>
> thanks for joining your RData, but I can't guess what is wrong if I don't have your R command. Besides, and as you suggest, did you check if there are NAs in your spatial coordinates?
>
> Best
>
> Thibaut
>
>
>
> ________________________________________
> From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Nevil Amos [nevil.amos at gmail.com]
> Sent: 03 May 2010 11:06
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] Error in spdep::lag.listw(listw, x,   TRUE) : object lengths differ
>
> I am receiving the below error message presumably because one of my data
> fileds contians a missing value or something similar?
>
> Any indications of how to trace it back would be appreciated.  I have
> attached the workspace if that is permissible.
>
> Choose a connection network:
>            Delaunay triangulation (type 1)
>            Gabriel graph (type 2)
>            Relative neighbours (type 3)
>            Minimum spanning tree (type 4)
>            Neighbourhood by distance (type 5)
>            K nearest neighbours (type 6)
>            Inverse distances (type 7)
> Answer: 1
>
> Keep this graph (y/n)? y
> Error in spdep::lag.listw(listw, x, TRUE) : object lengths differ
>    

-------------- next part --------------
A non-text attachment was scrubbed...
Name: spcaerror.RData
Type: application/octet-stream
Size: 18564 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20100504/3da8fdda/attachment-0001.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spca.r
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20100504/3da8fdda/attachment-0001.txt>


More information about the adegenet-forum mailing list