0

I've loaded a .xlsx file into R using the openxlsx package and converted it into a tibble using the as_tibble command. Within the data, one of the variables is the dates of the events, if I run the .xlsx file in Excel the dates are comprehensible and in the correct format (Image), although when I load it with R it changes into a number that has no relation with the actual date. I've tried to convert it using as.Date and as.POSIX functions but R don't even recognise it as a date. Any ideas on how can I get the correct dates??
The variable of interest is the one named DATA (Date in portuguese).

> Dados_Financeiros <- read.xlsx("./data/Dados_Financeiros.xlsx")
> Dados_financeiros <- as_tibble(Dados_Financeiros)
> head(Dados_financeiros)
# A tibble: 6 x 6
   SEQ. CODIGO  DATA LANÇAMENTO   SAÍDA ENTRADA
  <dbl>  <dbl> <dbl> <chr>        <dbl>   <dbl>
1   534     20 42004 PAGTO REFERE~  249.      NA
2   566     20 42003 PAGTO FORNEC~  255.      NA
3   372     40 42002 RECOLHIMENTO~  21.8      NA
4   391     40 42002 RECOLHIMENTO~  43.5      NA
5   392     40 42002 RECOLHIMENTO~  43.5      NA
6   393     40 42002 RECOLHIMENTO~  43.5      NA

The image shows the correct dates for the observations above in Excel (dd/mm/yyyy)

I apologise if I missed something, this is my first post here.

0 Answers0