user9085964
user9085964

Reputation: 49

Advise to filter yearmonth

I'm solving the exercises from book Forecasting:Principles and Practice 3rd edition

On chapter 7 ex 1 I want to filter Jan 2014 month from tsibbledata:vic_elec and summarise data by day, here's the code :

jan14_vic_elec <- vic_elec %>%
  filter(yearmonth(Time) == yearmonth("2014 Jan")) %>%
  index_by(Date = as_date(Time)) %>%
  summarise(
    Demand = sum(Demand),
    Temperature = max(Temperature)
  ) 

This chunk on the filter() functions gives an error :

  1. Error: Problem with filter() input ..1. i Input ..1 is
  2. yearmonth(Time) == yearmonth("2014 Jan"). x function
  3. 'Rcpp_precious_remove' not provided by package 'Rcpp'

Can somebody help ?

Upvotes: 1

Views: 834

Answers (1)

guna
guna

Reputation: 1208

Open a new r window, and do this. It should work!

Main issue is you have some package clashes. Hence start in a new window

library(fpp3)

jan14_vic_elec <- vic_elec %>%
  filter(yearmonth(Time) == yearmonth("2014 Jan")) %>%
  index_by(Date = as_date(Time)) %>%
  summarise(
    Demand = sum(Demand),
    Temperature = max(Temperature)
  ) 

Upvotes: 1

Related Questions