Alex Stepanov
Alex Stepanov

Reputation: 21

How to read xlsx file into R and convert it into tsibble object?

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 ?

Upvotes: 0

Views: 880

Answers (1)

Brutalroot
Brutalroot

Reputation: 311

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")

Upvotes: 0

Related Questions