My first training post - mutation error (KR)

Hello, I tried to solve this but can not figure it out. Below is a reprex of my problem. I am expecting to convert column to class but get an error saying that al formats failed to parse and no formats were found. Thank you in advance for your help!

#Reprex script 2

# install and load packages
pacman::p_load(rio, here, janitor, tidyverse, reprex, datapasta)

# import data
surv_raw <- data.frame(
  stringsAsFactors = FALSE,
  check.names = 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))  
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `onset_date = ymd(onset_date)`.
#> Caused by warning:
#> ! All formats failed to parse. No formats found.

# check the cleaned date column class and date range
class(surv_clean$onset_date)
#> [1] "Date"
range(surv_clean$onset_date)
#> [1] NA NA

#surv_raw %>% 
  #head(5) %>%                             # take the top 5 rows only
  #select(case_id, sex, `onset date`) %>%  # keep only these columns
  #dpasta()                                # produce standalone code

Hello,

The format of your date variable is mm/dd/YYY but you use the ymd function. Instead, use the mdy function which will work with your data.

All the best,

Tim

Thank you for your help!