I am trying to run frame_calendar for my univariate time series data in r. When I try to compute the calendar layout for the data frame, I am getting the following error.
Error in mutate_impl(.data, dots) : Evaluation error: object '72L' not found.
From similar threads, I see the evaluation error: object ' ' not found is usually for an object the users have input in the code. However, in my case, I am not referring to any '72L' in my code. And it is not in my data set as well. Can you please help me figure out how to fix this error? Any help is much appreciated.
Here is a part of my data.
Date_Time Time Date Year Month Mdate Day Hours_Time Hourly_Counts
1/1/2015 0:00 0:00:00 2015-01-01 2015 January 1 Thursday 1 72
1/1/2015 1:00 1:00:00 2015-01-01 2015 January 1 Thursday 2 48
1/1/2015 2:00 2:00:00 2015-01-01 2015 January 1 Thursday 3 53
1/1/2015 3:00 3:00:00 2015-01-01 2015 January 1 Thursday 4 84
1/1/2015 4:00 4:00:00 2015-01-01 2015 January 1 Thursday 5 68
Here's my code.
newdata <- read.csv("D:/NEWDATA.csv")
attach(newdata)
View(newdata)
newdata[,3] <- as.Date(Date, origin = "1/1/2000")
attach(newdata)
View(newdata)
library(dplyr)
# compute the calendar layout for the data frame
calendar_df <- newdata %>%
filter(Year == 2015) %>%
frame_calendar(x = Time, y = Hourly_Counts, date = Date)
frame_calendar
is fromsuggrants
? And two side notes: 1) don'tattach()
your data frame, especially if you're going to use tidyverse functions (which use nonstandard evaluation). 2) you do have72L
in your data. It's the integer72
, which is the first value innewdata$Hourly_Counts
– De Novowith()
or extract them explicitly (e.g.,newdata$Date
) – De Novoframe_calendar
is fromsuggrants
package. if i don'tattach()
data frame the first time after reading the data, as you suggested, then i get the error: > Error in as.Date(Date, origin = "1/1/2000") : object 'Date' not found. However, if Iattach()
the first time and omit the 2ndattach()
I still get the > Error in mutate_impl(.data, dots) : Evaluation error: object '72L' not found. Also, I can see your point in the integer72
, i just don't understand why the calendar layout is searching for a specific data value. I apologize if this is too basic question. – user4932167tibble()
as an alternative to convertDate
to aDate Class
.newpm10 <- read.csv("D:/NEWDATA.csv") View(newdata) newdata <- as_tibble(newdata) newdate <- as.Date(Date, origin = "1/1/2000") View(newdate) newdata <- mutate(newdata, Date = newdate) View(newdata) library(dplyr) # compute the calendar layout for the data frame calendar_df <- newdata %>% filter(Year == 2015) %>% frame_calendar(x = Time, y = Hourly_Counts, date = Date)
however it is still giving the same error. Thank you for your help. – user4932167attach
, which maskedHourly_Counts
in the call toframe_calendar
. See the answer below. To run it, make sure you start with a clean environment. You've runattach()
multiple times, which means you're going to have todetach
for each of those times. – De Novo