The wday() function in the lubridate package with the option label = TRUE returns the name of the day of the week in English. I'd like to know if it is possible to get the name of day of the week in another language. Is there any option for that ?
Not without writing your own method.
The days of the week are hardcoded in English in lubridate:::wday.numeric
labels <- c("Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday")
You could tweak the code from my answer here and replace the English names with names in the language of your choice.
# assuming x is your Date
c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday")[as.POSIXlt(x)$wday + 1]
Edit:
Here is a version that more closely matches lubridate
labels <- c("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi")
ordered(as.POSIXlt(x)$wday + 1, levels=1:7, labels=labels)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With