-2

Hy everybody

I already imported a excelsheet with stock data. The import changes the appearance of the date column. This means, imported in R the dataset has structure as seen in dummy_df2:

dates  <- as.tibble(c("32143","32146", "32147","32148"))
Stock1 <- as.tibble(c("NA", "NA", "NA", "NA"))
Stock2 <- as.tibble(c("NA", "NA", "NA", "NA"))
Stock3 <- as.tibble(c("NA", "NA", "NA", "NA"))

dummy_df <- bind_cols(dates,Stock1,Stock2,Stock3)
dummy_df2 <- dummy_df %>% rename(Date ="value", Stock1 = "value1", Stock2 = "value2", Stock3 = "value3")

I tried convert the Date column variables via the convertToDate command but it seems not to be the right approach. Does anyone know a handy solution to solve this issue?

Kind regards

DB89
  • 19
  • 2

1 Answers1

0
dummy_df2 %>%
  mutate(Date= as.Date(as.numeric(Date), origin = "1899-12-30"))

Hope this is what you are looking for. You would have to adjust the origin in case the date is not showing the results you expect.

AlexB
  • 3,061
  • 2
  • 17
  • 19