Hi I am epidemiologist supporting the Ebola response,
I tried to clean my data however in my date column all values were converted into NA. I don’t know what went wrong. I will appreciate your help. Kindly find the below reprex.
install and load packages
pacman::p_load(rio, janitor, tidyverse, datapasta,reprex)
data
surv_raw ← data.frame(
stringsAsFactors = FALSE,
case_id = c(“694928”,“86340d”,“92d002”,“544bd1”,“6056ba”),
sex = c(“m”, “f”, “f”, “f”, “f”),
onset_date = c(“11/9/2014”,“10/30/2014”,“8/16/2014”,“8/29/2014”,“10/20/2014”)
)
try to convert column to class “Date”
surv_clean ← surv_raw %>%
clean_names() %>%
mutate(onset_date = ymd(onset_date))
check the CLEANED date column class and date range
class(surv_clean$onset_date)
range(surv_clean$onset_date)