I am trying converting a column having values as character from Dataframe, to date values. But after converting the column values turned into 'NA'.
Here is my code:
library(rvest)
library(dplyr)
dvpact <- "https___covidlive.com.au_report_daily-vaccinations-people_act.html"
dvpactpage <- read_html(dvpact)
dvpactp <- dvpactpage %>% html_nodes("table.DAILY-VACCINATIONS-PEOPLE") %>% html_table() %>% .[[1]]
dvpactp$Date <- as.Date(dvpactp$Date, format = "%m-%d-%Y")
dvpactp
After the above conversion from character to date, the DATE column values shows 'NA'. Can anyone help me on this issue, please? Thanks in advance.
your link doesn't work, but if the format is 27 Jun 22
like on this page: https://covidlive.com.au/report/daily-vaccinations/aus,
then you'll need to change the format argument inside this line:
dvpactp$Date <- as.Date(dvpactp$Date, format = "%m-%d-%Y")
to format="%d %b %y"