> Can I ask you some doubts about the adehabitat packages and its commands?
As far as I understand, it is prefereable to use the adehabitatHR package, because adehabitat is no longer maintained. I believe the methods are the same between adehabitat and adehabitatHR, with the exception of the underlaying data structure. adehabitatHR makes use of sp object. But also see: vignette("adehabitatHR") for more informaiton. Best Johannes On Fri, Jul 26, 2013 at 12:05 AM, laila Aranda Romero <laila_...@hotmail.com > wrote: > Thank very much!!!!!! > > I want to use the adehabitat but as you realised I mixed up both packages > thinking their command were the same. I got almost crazy to understand why > this error happened. [image: Emoji] > > Can I ask you some doubts about the adehabitat packages and its commands? > > Laila > > > From: animov-requ...@faunalia.it > > Subject: AniMov Digest, Vol 89, Issue 4 > > To: animov@faunalia.it > > Date: Thu, 25 Jul 2013 23:45:52 +0200 > > > > Send AniMov mailing list submissions to > > animov@faunalia.it > > > > To subscribe or unsubscribe via the World Wide Web, visit > > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov > > or, via email, send a message with subject or body 'help' to > > animov-requ...@faunalia.it > > > > You can reach the person managing the list at > > animov-ow...@faunalia.it > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of AniMov digest..." > > > > > > Today's Topics: > > > > 1. Kernel density surfaces (laila Aranda Romero) > > 2. Re: Kernel density surfaces (Johannes Signer) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Thu, 25 Jul 2013 21:07:53 +0000 > > From: laila Aranda Romero <laila_...@hotmail.com> > > To: "animov@faunalia.it" <animov@faunalia.it> > > Subject: [AniMov] Kernel density surfaces > > Message-ID: <dub116-w35ce0e71e75e84184256929e...@phx.gbl> > > Content-Type: text/plain; charset="iso-8859-1" > > > > He everybody, > > > > I'm studying the migration pattern and wintering distribution of the > Great shearwater using geolocation data. For this, I want to work out the > kernel density surfaces using the package adehabitat of R. However, I've > some problems when I'm trying to run my script. > > > > Original data: > > head(Geo7) > > lon latcom > > 27 30.73 -41.08 > > 30 37.44 -40.66 > > 31 37.59 -40.54 > > 33 46.27 -43.86 > > 35 49.94 -43.25 > > 38 53.52 -40.07 > > > class(Geo7) > > [1] "data.frame" > > > str(Geo7) > > 'data.frame': 160 obs. of 2 variables: > > $ lon : num 30.7 37.4 37.6 46.3 49.9 ... > > $ latcom: num -41.1 -40.7 -40.5 -43.9 -43.2 .. > > Script: > > Geo7 <- subset(Geo6b, select=c (lon, latcom)) ########## cambiar latitud > y longitud de orden > > location<-project(Geo7,list(proj="laea", lat_O=1,lon_0=2, x_0=6, > y_0=7),inverse=FALSE, degrees=TRUE, silent=FALSE) #### we use Lambert > azimuthal equal-area projection > > location1a <- data.frame(location) #### It's necessary to convert the > list into dataframe > > xy= location1a[c("x", "y")] > > class(location1a) > > coordinates(location1a) <- ~x+y ###### To convert mapping coordinates to > Spatial points > > class(location1a) > > > > ################KERNEL > > Kernel1<-kernelUD(location1a, h="href",grid=40,same4all=F, > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > image(Kernel1, axes=FALSE, mar=c(0,0,2,0), addcontour=TRUE, > addpoints=TRUE) > > kernel2 <-getvolumeUD(Kernel1) > > Kernel3 <- kernel.area(kernel2, id=NULL, h="href", grid=40, > same4all=FALSE, hlim=c(0.1,1.5), kern="bivnorm", levels=seq(25,95,by=10), > unin=c("m"), unout=c("m2"), extent=0.5) ###### same problem I need two > columns instead of oneele > > Kernel6<-getverticeshr(Kernel1,lev=40) > > image(Kernel1) ### problemas con la paleta por eso he eliminado > col=rainbow(4) > > plot(Kernel6, add=TRUE) > > Kernel7 <- getverticeshr(kernel1,lev=90) > > image(Kernel1) > > plot(Kernel6, add=TRUE) > > > > When a run it: > > location<-project(Geo7,list(proj="laea", lat_O=1,lon_0=2, x_0=6, > y_0=7),inverse=FALSE, degrees=TRUE, silent=FALSE) #### we use Lambert > azimuthal equal-area projection > > > class(location) > > [1] "list" > > > str(location) > > List of 2 > > $ x: num [1:160] 2533084 3115667 3132780 3682706 3994351 ... > > $ y: num [1:160] -4593850 -4615167 -4603968 -5069889 -5060989 ... > > > location1a <- data.frame(location) #### It's necessary to convert the > list into dataframe > > > xy= location1a[c("x", "y")] > > > class(location1a) > > [1] "data.frame" > > > coordinates(location1a) <- ~x+y ###### To convert mapping coordinates > to Spatial points > > > class(location1a) > > [1] "SpatialPoints" > > attr(,"package") > > [1] "sp" Kernel1<-kernelUD(location1a, h="href",grid=40,same4all=F, > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > Error en if (ncol(xy) != 2) stop("xy should have 2 columns") : > > argumento tiene longitud cero I would appreciate a lot if someone can > help me to find a solution to this error. Laila > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: < > http://lists.faunalia.it/pipermail/animov/attachments/20130725/53483280/attachment-0001.html > > > > > > ------------------------------ > > > > Message: 2 > > Date: Thu, 25 Jul 2013 23:45:48 +0200 > > From: Johannes Signer <j.m.sig...@gmail.com> > > To: Animal Movement <animov@faunalia.it> > > Subject: Re: [AniMov] Kernel density surfaces > > Message-ID: > > <CAC8qavs_gJNVT_27R3Fp2BfCRgm6jg7oBk5eL8x=gbg+s+m...@mail.gmail.com> > > Content-Type: text/plain; charset="iso-8859-1" > > > > Hello Laila, > > > > do you possibly mix adehabitat and adehabitatHR? See code below. > > > > Hope this helps, > > Johannes > > > > > > library(adehabitat) > > library(adehabitatHR) > > library(proj4) > > > > ## Original data: > > > > Geo7 <- read.table(textConnection(" > > lon latcom > > 27 30.73 -41.08 > > 30 37.44 -40.66 > > 31 37.59 -40.54 > > 33 46.27 -43.86 > > 35 49.94 -43.25 > > 38 53.52 -40.07"), header=TRUE) > > > > > > > > location <- proj4::project(Geo7,list(proj="laea", lat_O=1,lon_0=2, x_0=6, > > y_0=7),inverse=FALSE, degrees=TRUE, silent=FALSE) #### we use Lambert > > azimuthal equal-area projection > > > > location1a <- data.frame(location) #### It's necessary to convert the > > list into dataframe > > xy= location1a[c("x", "y")] > > class(location1a) > > coordinates(location1a) <- ~x+y ###### To convert mapping coordinates > > to Spatial points > > class(location1a) > > > > ################ KERNEL > > ## Do you load adehabitat or adehabitatHR? > > > > ## This fails, because adehabitat::kernelUD requires coordinates as a > data > > frame > > Kernel1 <- adehabitat::kernelUD(location1a, h="href",grid=40,same4all=F, > > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > ## Error in if (ncol(xy) != 2) stop("xy should have 2 columns") : > > ## argument is of length zero > > > > ## Works > > Kernel1 <- adehabitat::kernelUD(data.frame(location), > > h="href",grid=40,same4all=F, > > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > > > > > ## Works as expected > > Kernel1 <- adehabitatHR::kernelUD(location1a, > h="href",grid=40,same4all=F, > > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > > > > > > > On Thu, Jul 25, 2013 at 11:07 PM, laila Aranda Romero < > laila_...@hotmail.com > > > wrote: > > > > > He everybody, > > > > > > I'm studying the migration pattern and wintering distribution of the > > > Great shearwater using geolocation data. For this, I want to work out > the > > > kernel density surfaces using the package adehabitat of R. However, > I've > > > some problems when I'm trying to run my script. > > > > > > Original data: > > > > > > head(Geo7) lon latcom > > > 27 30.73 -41.08 > > > 30 37.44 -40.6631 37.59 -40.54 > > > 33 46.27 -43.86 > > > 35 49.94 -43.25 > > > 38 53.52 -40.07> class(Geo7)[1] "data.frame"> str(Geo7)'data.frame': > 160 obs. of 2 variables: > > > $ lon : num 30.7 37.4 37.6 46.3 49.9 ... > > > $ latcom: num -41.1 -40.7 -40.5 -43.9 -43.2 .. > > > > > > > > > Script: > > > Geo7 <- subset(Geo6b, select=c (lon, latcom)) ########## cambiar > latitud y > > > longitud de orden > > > location<-project(Geo7,list(proj="laea", lat_O=1,lon_0=2, x_0=6, > > > y_0=7),inverse=FALSE, degrees=TRUE, silent=FALSE) #### we use Lambert > > > azimuthal equal-area projection > > > location1a <- data.frame(location) #### It's necessary to convert the > > > list into dataframe > > > xy= location1a[c("x", "y")] > > > class(location1a) > > > coordinates(location1a) <- ~x+y ###### To convert mapping coordinates > > > to Spatial points > > > class(location1a) > > > > > > ################KERNEL > > > Kernel1<-kernelUD(location1a, h="href",grid=40,same4all=F, > > > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ### > > > image(Kernel1, axes=FALSE, mar=c(0,0,2,0), addcontour=TRUE, > addpoints=TRUE) > > > kernel2 <-getvolumeUD(Kernel1) > > > Kernel3 <- kernel.area(kernel2, id=NULL, h="href", grid=40, > > > same4all=FALSE, hlim=c(0.1,1.5), kern="bivnorm", > levels=seq(25,95,by=10), > > > unin=c("m"), unout=c("m2"), extent=0.5) ###### same problem I need two > > > columns instead of oneele > > > Kernel6<-getverticeshr(Kernel1,lev=40) > > > image(Kernel1) ### problemas con la paleta por eso he eliminado > > > col=rainbow(4) > > > plot(Kernel6, add=TRUE) > > > Kernel7 <- getverticeshr(kernel1,lev=90) > > > image(Kernel1) > > > plot(Kernel6, add=TRUE) > > > > > > When a run it: > > > > > > location<-project(Geo7,list(proj="laea", lat_O=1,lon_0=2, x_0=6, > y_0=7),inverse=FALSE, degrees=TRUE, silent=FALSE) #### we use Lambert > azimuthal equal-area projection> class(location)[1] "list"> > str(location)List of 2 > > > $ x: num [1:160] 2533084 3115667 3132780 3682706 3994351 ... > > > $ y: num [1:160] -4593850 -4615167 -4603968 -5069889 -5060989 ...> > location1a <- data.frame(location) #### It's necessary to convert the list > into dataframe> xy= location1a[c("x", "y")]> class(location1a)[1] > "data.frame"> coordinates(location1a) <- ~x+y ###### To convert mapping > coordinates to Spatial points> class(location1a)[1] "SpatialPoints" > > > attr(,"package") > > > [1] "sp" > > > > > > > > > > > > > > > > > > Kernel1<-kernelUD(location1a, h="href",grid=40,same4all=F, > hlim=c(0.1,1.5),kern=c("bivnorm"),extent=0.5) ###Error en if (ncol(xy) != > 2) stop("xy should have 2 columns") : > > > argumento tiene longitud cero > > > > > > > > > > > > I would appreciate a lot if someone can help me to find a solution to > this error. > > > > > > > > > > > > Laila > > > > > > > > > _______________________________________________ > > > AniMov mailing list > > > AniMov@faunalia.it > > > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov > > > > > > > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: < > http://lists.faunalia.it/pipermail/animov/attachments/20130725/c0115dcf/attachment.html > > > > > > ------------------------------ > > > > Subject: Digest Footer > > > > _______________________________________________ > > AniMov mailing list > > AniMov@faunalia.it > > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov > > > > > > ------------------------------ > > > > End of AniMov Digest, Vol 89, Issue 4 > > ************************************* > > _______________________________________________ > AniMov mailing list > AniMov@faunalia.it > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov > > -- ## ## Contact: ## Johannes Signer, MSc ## PhD-Candidate -- Wildlife Management ## Dept. of Forest Zoology & Forest Conservation ## University of Goettingen ## Buesgenweg 3 (room 85) ## 37077 Goettingen, Germany ## e: jmsig...@gmail.com ## skype: j.m.signer ## ##
_______________________________________________ AniMov mailing list AniMov@faunalia.it http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov