Problem of converting to tsibble object

I have met a problem that when I run as_tsibble() function the type of object does not change.

My primary data includes two varables, date (like 2019-01-01) and numbers of visitors. There is no missing value and each day only has one observation.

Before these records do work, however, when I am trying to make the bookdown it returns error.

Error in UseMethod("index_by") :
There is no method to apply "index_by" for "data.frame" object.

I suppose the problem is caused by the "as_tsibble" function. Because I check the class of "data_tsb", it only returns "data.frame". However, there is no error message when running the "as_tsibble" code.

I can't find how to solve the problem, and I haven't found any simmilar questions.
Can you please help? Thank you!

 # remove duplicates and NA
data_wd <- primary_data %>%  dplyr::distinct(.)  %>% na.omit()

#convert to tsibble
data_tsb <-  data_wd %>% as_tsibble(index = date, regular= FALSE) 

#regularise the tsibble as daily
visit_daily <- data_tsb %>% index_by(visit_date = lubridate::floor_date(date, "1 days")) %>% summarise(attendance=sum(visit)) %>% fill_gaps(attendance=0) %>% ungroup()

I have solved the problem by deleting the lresource pack and re-install all packages that you need. The problem might be caused by the newest "tsibble" package I downloaded from CRAN have not been moved to the local track completely and the old one has not be removed.

Just delete the invaild package in you loacl track, and re-install the it.

This topic was automatically closed 7 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.