No need for substring, just use gsub:
gsub( " .*$", "", dob )
# [1] "9/9/43" "9/17/88" "11/21/48"
A space (), then any character (
.
) any number of times (*
) until the end of the string ($
). See ?regex to learn regular expressions.
No need for substring, just use gsub:
gsub( " .*$", "", dob )
# [1] "9/9/43" "9/17/88" "11/21/48"
A space (), then any character (
.
) any number of times (*
) until the end of the string ($
). See ?regex to learn regular expressions.