[R-sig-eco] adehabitatLT merge different bursts for same ID

Mathieu Basille basille.web at ase-research.org
Thu Feb 2 18:46:05 CET 2017


Hey Giulia,

By definition, you cannot have a single burst with different burst names.
If you really want to merge all bursts into one, you need to have a unique
burst ID:

* Either in your simulations
* or later one after your call to ld:

migrdf <- ld(migr)
migrdf$movtype <- migrdf$burst    # If you want to keep the movement type
migrdf$burst <- "Prova"           # Same as ID, but does not need to be
migr_singleburst <- dl(migrdf)

Hope this helps,
Mathieu.


On 02/02/2017 10:00 AM, g.cerritelli wrote:
> Dear list,
> 
> I'm trying to simulate the migratory movement of an animal, following the
> work of Bunnefeld et al 2011.
> I started from a dataset of dates and used the function simm.mou and
> simm.bb in adehabitatLT to simulate five distinct movement types: the stay
> in a wintering area, the migration to reproductive areas, the stay in this
> sites, the return migration and finally the stay in wintering areas.
> Now I would like to merge this five simulations into one and so obtain a
> single object ltraj with all the information on the whole movement. For
> this purpose, I assigned to the five simulation the same ID but different
> burst and than used the string c() to put all the simulations in one object
> ltraj. However the five bursts remained separated.
> Does anyone know how can I actually merge in adehabitatLT this tracks to be
> one?
> 
> 
> da = as.POSIXct(strptime(as.character(data$timestamp),
> tz="",format="%d/%m/%Y %H:%M:%S"))
> da[1:10]
>  [1] "2014-04-29 00:00:00 CEST" "2014-04-29 00:19:00 CEST"
>  [3] "2014-04-29 00:37:00 CEST" "2014-04-29 00:55:00 CEST"
>  [5] "2014-04-29 01:14:00 CEST" "2014-04-29 01:32:00 CEST"
>  [7] "2014-04-29 01:51:00 CEST" "2014-04-29 02:09:00 CEST"
>  [9] "2014-04-29 02:27:00 CEST" "2014-04-29 02:46:00 CEST"
> 
> 
> hr<-simm.mou(da[1:70],b = c(0,
> 0),a=diag(c(0.001,0.001)),sigma=diag(c(100,100)),
>              x0 = c(0, 0),id = "Prova", burst = "HR1")
> bb<-simm.bb(da[71:110],
> begin=c(0,0),end=c(60000,60000),id="Prova",burst="migr")
> hr2<-simm.mou(da[111:210],b = c(60000,
> 60000),a=diag(c(0.001,0.001)),sigma=diag(c(100,100)),
>               x0 = c(60000, 60000),id = "Prova",burst="HR2")
> bb2<-simm.bb(da[211:240],
> begin=c(60000,60000),end=c(0,0),id="Prova",burst="migr2")
> hr3<-simm.mou(da[241:350],b = c(0,
> 0),a=diag(c(0.001,0.001)),sigma=diag(c(100,100)),
>              x0 = c(0, 0),id = "Prova", burst = "HR3")
> migr<- c(hr,bb,hr2,bb2,hr3)
> 
> ld(migr)
>           x         y                date        dx        dy      dist   dt
> 68   1273.749  7132.147 2014-04-29 20:31:00 -4814.308 -9767.770 10889.761 1080
> 69  -3540.560 -2635.623 2014-04-29 20:49:00 -2708.557 -1208.668  2966.001 1140
> 70  -6249.117 -3844.291 2014-04-29 21:08:00        NA        NA        NA   NA
> 111     0.000     0.000 2014-04-29 21:26:00  1444.220  1450.462  2046.854 1080
> 210  1444.220  1450.462 2014-04-29 21:44:00  1545.417  1533.493  2177.134 1140
> 310  2989.636  2983.956 2014-04-29 22:03:00  1505.393  1525.449  2143.176 1080
> 
>         R2n  abs.angle     rel.angle    id burst                      pkey
> 68  52489961 -2.0287292 -3.1366093166 Prova   HR1 Prova.2014-04-29 20:31:00
> 69  19482070 -2.7218694 -0.6931401962 Prova   HR1 Prova.2014-04-29 20:49:00
> 70  53830039         NA            NA Prova   HR1 Prova.2014-04-29 21:08:00
> 111        0  0.7875548            NA Prova  migr Prova.2014-04-29 21:26:00
> 210  4189611  0.7815256 -0.0060292387 Prova  migr Prova.2014-04-29 21:44:00
> 310 17841916  0.7920154  0.0104897686 Prova  migr Prova.2014-04-29 22:03:00
> 
> 
> Thank you in advance for your time.
> 
> Giulia
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 

Mathieu Basille

basille at ufl.edu | http://ase-research.org/basille
+1 954-577-6314 | University of Florida FLREC

  « Le tout est de tout dire, et je manque de mots
  Et je manque de temps, et je manque d'audace. »
  — Paul Éluard

This message is signed to guarantee its authenticity.
For a true private correspondence, use my public key
to encrypt your messages:

  http://mathieu.basille.net/pub.asc

Learn more: http://mzl.la/1BsOGiZ



More information about the R-sig-ecology mailing list