-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date/time variable not detected in data #57
Comments
Hi, You'll have to include the code you are using & some example data that reproduces the error. Without this, I can only guess at what's causing the problem. Thanks, Ian |
Here is what I did:
View(BermudaChloe)
fit <- fit_ssm(BermudaChloe,
+ vmax= 4,
+ model = "mp",
+ time.step = 24,
+ control = ssm_control(verbose = 0))
Error in format_data(x, ...) :
A date/time variable must be included in the input data;
see vignette('Overview', package = 'aniMotum')
I am fairly new at this so I am sure the answer may be glaringly obvious,
so thank you for your time!
…On Tue, Feb 13, 2024 at 9:28 AM Ian Jonsen ***@***.***> wrote:
Hi, You'll have to include the code you are using & some example data that
reproduces the error. Without this, I can only guess at what's causing the
problem.
Thanks, Ian
—
Reply to this email directly, view it on GitHub
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ianjonsen_aniMotum_issues_57-23issuecomment-2D1941637544&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=-oeRK0P6HW04-n6YyJRlKJR0ZbMwMaoIhdB2Jgr4gKWehjtnAwPHMdALMLUfC0gK&s=XOCuboWenvmMNfnYtyr4zLcI19mIdFGXs7RG9g603aY&e=>,
or unsubscribe
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_BGCH7ZDPCMH3GEE3KFETNJTYTNZ7FAVCNFSM6AAAAABDDIR5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBRGYZTONJUGQ&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=-oeRK0P6HW04-n6YyJRlKJR0ZbMwMaoIhdB2Jgr4gKWehjtnAwPHMdALMLUfC0gK&s=qKTZ-9s5XAFYOu89rEY4PvVNm3uRaGeqgGDHljo32Yc&e=>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Nikki Larkin | SRGA | 401-874-6139
|
Ok, half-way there. You will have to save your data as a .csv file (eg. using |
Sorry, I replied to the email with the attachment, I guess that doesn't work! |
There are a few issues going on here. First, you have a mix of uppercase and lowercase variable names so you either have to edit these so they are all lowercase prior to using
But this also results in an error because you have missing entries, not classed as
So you need to remove these, as all other variables apart from
But this shows that you have a few fairly large data gaps, which can be problematic for estimating sensible locations and move persistence. Finally, the first and last observed locations are substantially far away from the rest of the observed locations - you can see these in the x and y plot panels above, and both in the map below. Suggesting that these observations may be erroneous (highlighted in red):
Hope this helps |
This is great, thank you! I knew it would be an easy fix but I am having a
hard time finding consistent instruction on getting from point A to point B
in R. I appreciate your detailed directions!
…On Fri, Feb 16, 2024 at 9:05 AM Ian Jonsen ***@***.***> wrote:
There are a few issues going on here. First, you have a mix of uppercase
and lowercase variable names so you either have to edit these so they are
all lowercase prior to using aniMotum functions or you have to call
format_data() and provide the exact variable names, eg:
data <- aniMotum::format_data(BermudaChloe, date = "Date", coord = c("lon", "Lat"))
But this also results in an error because you have missing entries, not
classed as NA's in the Date variable:
d$Date
[1] "2017-08-13 23:35:40" "2017-08-14 10:00:09" "2017-08-15 09:14:24" "2017-08-15 10:17:39" "2017-08-15 10:44:45" "2017-08-16 02:00:38" "2017-08-16 09:03:25" "2017-08-16 22:00:01"
[9] "2017-08-16 22:00:01" "2017-08-17 07:09:34" "2017-08-17 09:11:36" "2017-08-17 10:29:04" "2017-08-17 10:29:04" "2017-08-17 21:43:33" "2017-08-18 21:03:09" "2017-08-19 02:36:02"
[17] "2017-08-19 09:34:01" "2017-08-19 19:52:10" "2017-08-20 02:16:22" "2017-08-20 10:55:15" "2017-08-20 22:53:11" "" "" ""
[25] "" "2017-08-25 21:42:11" "2017-08-25 21:59:54" "2017-08-25 22:23:26" "2017-08-26 01:01:35" "2017-08-26 07:10:59" "2017-08-26 09:39:09" "2017-08-26 22:54:58"
[33] "2017-08-26 23:35:07" "2017-08-27 08:38:59" "2017-08-27 09:09:41" "2017-08-27 11:45:22" "2017-08-27 22:35:36" "2017-08-27 23:07:18" "" ""
[41] "2017-08-30 21:20:28" "2017-08-30 22:35:10" "2017-08-30 22:57:21" "2017-08-30 23:05:32" "2017-08-31 08:00:28" "2017-08-31 08:37:00" "2017-08-31 13:21:40" "2017-08-31 20:52:19"
[49] "2017-08-31 20:52:19" "2017-08-31 22:31:13" "2017-09-01 07:44:57" "2017-09-01 23:44:14" "2017-09-02 00:18:55" "2017-09-02 23:57:48" "2017-09-03 10:23:45" "2017-09-03 21:52:22"
[57] "2017-09-03 23:04:09" "2017-09-04 02:56:34" "2017-09-04 08:18:46" "2017-09-04 09:42:21" "2017-09-04 18:28:16" "2017-09-04 20:13:17" "2017-09-04 21:40:34" "2017-09-04 23:16:30"
[65] "2017-09-05 09:29:58" "" "2017-09-07 10:02:28" "" "" "" "" ""
[73] "" "" "" "" "" "2017-09-18 01:26:47" "2017-09-18 19:11:10" "2017-09-18 23:59:59"
[81] "2017-09-19 23:04:55" "2017-09-20 02:24:18" "" "" "" "" "" ""
[89] "" "" "" "" "2017-10-01 00:11:53" "2017-10-01 23:12:49" "" ""
[97] "" "" "" "" "" "" "" ""
[105] "" "" "" "" "" "" "" ""
[113] "" "2017-10-21 10:33:03" "" ""
So you need to remove these, as all other variables apart from id are NA.
Then you can run format_data(), and then fit the SSM:
d <- subset(BermudaChloe, Date != "")
data <- aniMotum::format_data(d, date = "Date", coord = c("lon", "Lat"))
fit <- aniMotum::fit_ssm(data, max = 4, model = "mp", time.step = 24)
plot(fit, "p")
Rplot.jpeg (view on web)
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ianjonsen_aniMotum_assets_9984184_f7a890f6-2Da6c2-2D4ba8-2D80b4-2D15e922110eb8&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=S4q61joo55wZcGz_SUHkutjX4MGG1NtlA81N8ymLiM3X5eBpKR2FyMH1W7TgQBai&s=qRYP-edsAo2rtrd9YuyAPdFOz-mnA-drFfigi7yth4Y&e=>
But this shows that you have a few fairly large data gaps, which can be
problematic for estimating sensible locations and move persistence.
Finally, the first and last observed locations are substantially far away
from the rest of the observed locations - you can see these in the x and y
plot panels above, and both in the map below. Suggesting that these
observations may be erroneous (highlighted in red):
aniMotum::map(fit, what = "f")
Rplot01.jpeg (view on web)
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ianjonsen_aniMotum_assets_9984184_b11dd9cc-2Db83c-2D406d-2D9e4d-2Db71f776cdc41&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=S4q61joo55wZcGz_SUHkutjX4MGG1NtlA81N8ymLiM3X5eBpKR2FyMH1W7TgQBai&s=xY-PWJGHAQNTfRswkjyk51_-oX6boDK9R8iFe2XhHWU&e=>
Hope this helps
—
Reply to this email directly, view it on GitHub
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ianjonsen_aniMotum_issues_57-23issuecomment-2D1948445413&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=S4q61joo55wZcGz_SUHkutjX4MGG1NtlA81N8ymLiM3X5eBpKR2FyMH1W7TgQBai&s=1SiJ6bCyAakiLMvDk9vafhBq63oafSRlKBg_tsAS4h0&e=>,
or unsubscribe
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_BGCH7ZD2W2CYDIKISI3G3ZDYT5RSLAVCNFSM6AAAAABDDIR5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYGQ2DKNBRGM&d=DwMCaQ&c=dWz0sRZOjEnYSN4E4J0dug&r=4APPAm-hovjN3clsMhbH4Rm3zASqmg4dvLBhW1gAXh8&m=S4q61joo55wZcGz_SUHkutjX4MGG1NtlA81N8ymLiM3X5eBpKR2FyMH1W7TgQBai&s=QQ4y_2sAX0sx8Sj6BBnmCJtpzo4NUA4Y2PwpxEdwuUw&e=>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Nikki Larkin | SRGA | 401-874-6139
|
I formatted my data just like the overview page, it includes id, date, lat, lon, in order as shown.
When I run fit_ssm, I get the following error:
Error in format_data(BermudaChloe) :
A date/time variable must be included in the input data;
see vignette('Overview', package = 'aniMotum')
I have tried format_data on its own and get the same error.
Thank you for any help!!
The text was updated successfully, but these errors were encountered: