0

I would like to read a xlsx file into R, and create a tsibble object. It looks like this: https://docs.google.com/spreadsheets/d/119RXtTVJbHYeivorEtApbxQrLkLXolZdOc0kgCXFljQ/edit?usp=sharing

How can I do it ?

  • Did you read the data in R? After you do that you can use `tsibble::as_tsibble()` to convert it into `tsibble` object. – Ronak Shah Mar 19 '20 at 10:55
  • @RonakShah I did. When I use as_tsibble() after reading the file (df=readxl::read_xlsx()) I get: "Can't obtain the interval due to the mismatched index class." – Alex Stepanov Mar 20 '20 at 06:06
  • @Brutalroot Thanks, but how do I convert it to understandable format of (01.12.2018) instead of numeric 43435..? – Alex Stepanov Mar 20 '20 at 06:07

1 Answers1

0

Try this method:

library("openxlsx")
library("tsibble")

df <- data.frame(read.xlsx("Data.xlsx"))

tsibble <- as_tsibble(df, index = Date)

#Fuction to convert Date column to date format
tsibble$Date <- as.Date(tsibble$Date, origin = "1989-12-30")
Brutalroot
  • 311
  • 3
  • 8