##CSV file df date column separate to year and month columns.
Error: arrange() failed at implicit mutate() step.
- Problem with
mutate()column..1.
i..1 = Month.
x object 'Month' not found
Runrlang::last_error()to see where the error occurred.
##CSV file df date column separate to year and month columns.
Error: arrange() failed at implicit mutate() step.
mutate() column ..1...1 = Month.rlang::last_error() to see where the error occurred.The error message is quite explicit. It couldn't find Month in your dataset.
Without a sample of your data neither can we!
Can you provide a head( )?.
Can you provide a reprex?
If you can see Month (not month) as a column my gut feeling is there may be a rogue character that doesn't display on screen but is in the name. Janitor could be your friend. But I'm speculating...
The other time I see this is when I stupidly forget to pass my data to the mutate function!
library(tidyr)
setwd("D:\\time series assignment")
dir()
data=read.csv("data.CSV")
head(data)
data %>%
separate(Year..Month, into = c('Year', 'Month'), sep = '-') %>%
select(Year,Month,Tea.Production)
library(dplyr)
head(df)
str(df)
df=arrange(df,Month,Tea.Production)
modified data frame. I need to sort this data set according to month. All January values together and all February values together. likewise
df %>% arrange(Month)
Do you need the months to go in the correct order and the year too?
Basically i need to convert imported csv file df to tsibble
OK. Would it be better... to us as_tisbble by converting year..month to a proper date?
library(tidyr)
require(tsibble
setwd("D:\\time series assignment")
data=read.csv("data.CSV")
data %>%
mutate(YearMonth = as.Date(Paste 0(Year..Month,"-01")) %>%
as_tsibble(index=YearMonth, key=Tea.Production)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.