Problem with date format

Hello, Im new to RStudio. I need to merge 2 Excels and order it by Date.
The merging works but when I try to order it by Date it has a wrong format.
class(Portafolio$Date)
Portafolio$Date<-as.Date(Portafolio$Date,format="%d/%m/%Y")
class(Portafolio$Date)
View(Portafolio)

With this code the dates I get are 0022-02-01
when I need something like 08/06/22
and they are not even in order. I have a similar code with different Excel worksheets and this works but with the new worksheets it does not and I've already checked the worksheets have the same format and everything so I don't know what is wrong.

Can you help me? Thank you

Please post the output of

dput(head(Portafolio))

using the version of Portafolio before you try to change the Date column with as.Date. Place a line with three back ticks just before and after you posted output, like this
```
Posted output of dput()
```

1 Like

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