[R-sig-eco] Fwd: spatial analysis with dbMEM

Aaron Hogan hogieskier at gmail.com
Tue Jan 17 06:06:11 CET 2017


Hi Andy,

I am probably not the most qualified person to answer this, but I think I
may have a solution to your issue.


1.  It seems that nb is an old (or alternative) way to specify the labels
for the plot.  The documentation suggests using label.  I could not find nb
defined and was rarely used in:
https://cran.r-project.org/web/packages/adegraphics/adegraphics.pdf
<https://cran.r-project.org/web/packages/adegraphics/adegraphics.pdf>

2.  This example helped me better understand the syntax of the s.label
function:

data(mafragh, package = "ade4")
g2 <- s.label(mafragh$xy, nb = mafragh$nb, paxes.draw = FALSE)

You can see that both the $nb list and $xy dataframe have the same number
of observations (which is important- as you point out).

3.  you can extract the list from the mite data using:   attr(mite.dbmem1,
"listw")$neighbours

so putting it all together:

s.label(mite.xy, label = attr(mite.dbmem1, "listw")$neighbours)


alternatively (making the list an object named mite.nb):

mite.nb <- attr(mite.dbmem1, "listw")$neighbours
s.label(mite.xy, label = mite.nb)



Code generated the plot for me.
I hope this helps,
Best,

Aaron Hogan
(970) 485-1412
hogieskier at gmail.com

On Mon, Jan 16, 2017 at 9:50 PM, Andrew Halford <andrew.halford at gmail.com>
wrote:

> Hi Listers,
>
> I am trying to wrap my head around spatial eigenvector analyses and have
> been trying to recreate the example code attached to the dbmem{adespatial}
> documentation.
>
> I am getting an error message when I try to run the following... The data
> is drawn from the oribatid dataset.
>
> data(oribatid)
>
> mite <- oribatid$fau
> mite.xy <- oribatid$xy
> mite.dbmem1 <- dbmem(mite.xy, thresh=1.012, MEM.autocor = "non-null",
> silent = FALSE)
> s.label(mite.xy, nb = attr(mite.dbmem1, "listw"))
>
> Error in s.label(mite.xy, nb = attr(mite.dbmem1, "listw")) :
>   unused argument (nb = attr(mite.dbmem1, "listw"))
> I dont know what the nb argument is here?
>
> # Plot maps of the first 3 dbMEM eigenfunctions
> s.value(mite.xy, mite.dbmem1[,1:3])
>
> Error in s.value(mite.xy, mite.dbmem1[, 1:3]) :
>   Non equal row numbers 70 3
>
>
> I checked the mite.xy and mite.dbmem1 data and they both have 70 rows?
>
> Andy
>
>
>
> --
> Andrew Halford Ph.D
> Research Scientist (Kimberley Marine Parks)
> Dept. Parks and Wildlife
> Western Australia
>
> Ph: +61 8 9219 9795 <+61%208%209219%209795>
> Mobile: +61 (0) 468 419 473 <+61%20468%20419%20473>
>
>
>
> --
> Andrew Halford Ph.D
> Research Scientist (Kimberley Marine Parks)
> Dept. Parks and Wildlife
> Western Australia
>
> Ph: +61 8 9219 9795
> Mobile: +61 (0) 468 419 473
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list