Thank you for posting! Here is an outline of an effective post:
Describe your issue
unable to see date in my dataset after cleaning & mutate
What steps have you already taken to find an answer?
- Ensure you have searched the Epi R Handbook and internet forums like stackoverflow: https://stackoverflow.com/
Provide an example of your R code
install and load packages
pacman::p_load(rio, janitor, tidyverse, datapasta)
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))
#> 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
Created on 2024-03-12 with [reprex v2.1.0](https://reprex.tidyverse.org/)
Session info
## Follow-up
- Thank the volunteers who try to help you
- Mark one reply as the "Solution" if appropriate