Skip to content

using a time column which is not year #298

Answered by ericward-noaa
lily-greig asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Lily, this may be happening because time is assumed to be something that can be coerced to numeric internally. Could you try creating a new variable year_month_n that represents the months in chronological order, and passing that into the time argument?

df$year_month <- paste0(df$year, "_", sprintf("%02d", df$month))
df$year_month_n <- as.numeric(as.factor(df$year_month))

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lily-greig
Comment options

Answer selected by seananderson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants