how to get red of a letter in Date column

Dears,
I've been trying to read CSV data and i have the following code:

d_recovered <- recovered %>%
pivot_longer(-c(Province.State,Country.Region, Lat, Long), names_to = "date" , values_to = "recovered_num") %>%
clean_names() %>%
mutate(
date = as.Date(date, format = "%m/%d/%y")
) %>%
group_by(date, country_region) %>%
summarise(recovered_num = sum(recovered_num))

the question here is that how can i get red of X and replace it with Zero in the date column as it appears when i tried to read the file.

The dataset looks like the following:

and because of the X letter appeared in the date column i got NA values

And this is the result set i get because of the letter X in the date column:

image

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one: