Unexpected NA values in a date column

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)


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


1 Like


Please see the following thread for a solution to this problem: https://community.appliedepi.org/t/exercise-for-r-training-course-unexpected-na-value-in-date-column/2743/2

All the best,