You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I keep getting this error "Error in format_data(x, ...) : object 'xx' not found" when using (format_data) for (fit_ssm) although it has worked perfectly fine using the exact same dataset before.
Code below and subset data attached:
str(df)
spc_tbl_ [50 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ id : num [1:50] 172899 172899 172899 172899 172899 ...
$ date: POSIXct[1:50], format: "2018-10-26 06:27:00" "2018-10-26 07:07:30" "2018-10-26 08:11:37" ...
$ lc : chr [1:50] "3" "3" "A" "A" ...
$ lon : num [1:50] 146 146 146 146 146 ...
$ lat : num [1:50] -14.2 -14.2 -14.2 -14.2 -13.9 ...
$ smaj: num [1:50] 511 336 5571 714 17066 ...
$ smin: num [1:50] 65 184 212 134 5362 ...
$ eor : num [1:50] 83 167 158 148 100 101 94 38 39 59 ...
$ x.sd: logi [1:50] NA NA NA NA NA NA ...
$ y.sd: logi [1:50] NA NA NA NA NA NA ...
fit <- df |>
aniMotum::fit_ssm(vmax = 1.15,
model = "crw",
time.step = 24,
spdf = TRUE,
#map = list(psi = factor(NA)),
control = ssm_control(verbose = 1, se = TRUE),
pf=FALSE)
Error in format_data(x, ...) : object 'xx' not found
I have even re-installed R, RStudio and Rtools, updated all packages, and tried 4 different computers (Macs and PCs).
I'm running out of ideas and hope @ianjonsen or anyone else who has experienced this issue can help?
So your case is one I didn't anticipate. Your data.frame df already has all the variables that format_data would add. This should usually not occur with unformatted Argos track data as the variables x.sd and y.sd are aniMotum constructions. If you do the following, your example runs without error:
## drop the `x.sd` and `y.sd` variables
df <- df[, 1:8]
fit <- df |>
aniMotum::fit_ssm(vmax = 1.15,
model = "crw",
time.step = 24,
spdf = TRUE,
#map = list(psi = factor(NA)),
control = ssm_control(verbose = 1, se = TRUE),
pf=FALSE)
Note, in your case there is no need to use format_data because the variables in df already conform exactly to those expected by fit_ssm.
I've made a small fix to format_data so your originally structured data will not result in an error.
Hi,
I keep getting this error "Error in format_data(x, ...) : object 'xx' not found" when using (format_data) for (fit_ssm) although it has worked perfectly fine using the exact same dataset before.
Code below and subset data attached:
str(df)
spc_tbl_ [50 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ id : num [1:50] 172899 172899 172899 172899 172899 ...
$ date: POSIXct[1:50], format: "2018-10-26 06:27:00" "2018-10-26 07:07:30" "2018-10-26 08:11:37" ...
$ lc : chr [1:50] "3" "3" "A" "A" ...
$ lon : num [1:50] 146 146 146 146 146 ...
$ lat : num [1:50] -14.2 -14.2 -14.2 -14.2 -13.9 ...
$ smaj: num [1:50] 511 336 5571 714 17066 ...
$ smin: num [1:50] 65 184 212 134 5362 ...
$ eor : num [1:50] 83 167 158 148 100 101 94 38 39 59 ...
$ x.sd: logi [1:50] NA NA NA NA NA NA ...
$ y.sd: logi [1:50] NA NA NA NA NA NA ...
df <- aniMotum::format_data(df,
id = "id",
date = "date",
lc = "lc",
coord = c("lon", "lat"),
epar = c("smaj", "smin", "eor"),
sderr = c("x.sd", "y.sd"),
tz = "UTC")
fit <- df |>
aniMotum::fit_ssm(vmax = 1.15,
model = "crw",
time.step = 24,
spdf = TRUE,
#map = list(psi = factor(NA)),
control = ssm_control(verbose = 1, se = TRUE),
pf=FALSE)
Error in format_data(x, ...) : object 'xx' not found
I have even re-installed R, RStudio and Rtools, updated all packages, and tried 4 different computers (Macs and PCs).
I'm running out of ideas and hope @ianjonsen or anyone else who has experienced this issue can help?
Cheers
Ingo
GitHub_aniMotum_example_subset.csv
The text was updated successfully, but these errors were encountered: