as.telemetry import and ctmm.fit errors

650 views
Skip to first unread message

aran....@googlemail.com

unread,
May 30, 2017, 11:33:13 AM5/30/17
to ctmm R user group
Dear Christen,

I have imported my telemetry dataset to Movebank and downloaded the corresponding csv files. I've sent a subset of this data to you to take a look at. This imports successfully as a telemetry object using the as.telemetry function:

TurtTel <- as.telemetry("TurtleTelemetry.csv",
                           timezone="UTC",
                           projection=NULL,
                           UERE=NULL)

, however as one individual has only 1 datapoint, the following error is produced:

1: In max(v) : no non-missing arguments to max; returning -Inf
2: In min(dt) : no non-missing arguments to min; returning Inf

Therefore, when I try to run a ctmm with no accounting for autocorrelation (ctmm.fit(TurtTel)) the following error is reported:

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows:

followed by a series of row numbers.

I also thought about changing the individual identifier to all be the same, as we're primarily interested in the behaviour of turtles from a single beach, not necessarily individuals, however if I try to import this updated csv using the same procedure above, the following warning message:

Error in `colnames<-`(`*tmp*`, value = c("x", "y")) : 
  attempt to set 'colnames' on an object with less than two dimensions

Do you have any suggestions?

Many thanks,

Aran

Xianghui Dong

unread,
May 30, 2017, 11:58:55 AM5/30/17
to ctmm R user group, aran....@googlemail.com
If removing the single data point individual is not a problem for your analysis, you can always remove them.

If you are not familiar with R enough to remove them with R code, you can actually use our ctmm web app for this:

1. You can sort the individuals in data by data points column in the Individuals table of Visualization page.
2. Then you can select some individuals, click a button to remove them from the data.

Though you will need to save the updated data as csv (or even telemetry object) so you can use it in your analysis. I haven't add this feature yet because I didn't expect this usage. It will be trivial to implement if it's useful.

Best,
Xianghui Dong

aran....@googlemail.com

unread,
May 30, 2017, 2:41:08 PM5/30/17
to ctmm R user group
Thank you for your response, I've managed to remove that single data point, however I'm still getting the error:

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows:

when I try to run ctmm.fit.
I'm not sure what this error is referring too.

Many thanks,

Aran

Christen Fleming

unread,
May 30, 2017, 4:28:25 PM5/30/17
to ctmm R user group, aran....@googlemail.com
Hi Aran,

1. The Github version of the package seems to be able to import the data without errors, though with the single-location individual you can't do any analysis with that currently.
2. It looks like you are trying to feed the entire list of turtles into ctmm.fit. Fitting is one at a time currently.
3. The data you sent me did not import correctly with the default timeformat option. You will want to make sure that as.POSIXct can read your timestamps correctly. Sometimes it needs assistance.

Best,
Chris

aran....@googlemail.com

unread,
May 31, 2017, 10:18:05 AM5/31/17
to ctmm R user group, aran....@googlemail.com
Hi Chris,

Thanks for your response, I encountered the same problem with importing if I used anything but the file downloaded straight from Movebank.
I tried running a basic KDE with 

M0 <- ctmm.fit(LBTurTelem$`1109`)

however now I get the following error:

Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
  cannot coerce class "structure("telemetry", package = "ctmm")" to a data.frame

LBTurTelem$`1109` is a Formal class telemetry object, the same the 'buffalo' dataset subset used in the example you provide in the package manual, which runs well, so I'm unsure as to why my data is generating errors.

Many thanks,


Aran

aran....@googlemail.com

unread,
Jun 1, 2017, 10:05:06 AM6/1/17
to ctmm R user group, aran....@googlemail.com
Update to the above post, I'm now no longer getting the error. I'm not too sure what changed but it seems to be running well now.

Many thanks for all the help,

Aran
Reply all
Reply to author
Forward
0 new messages