I am having difficulty separating data in one column into multiple columns -- the data has multiple separators. I checked the stackoverflow solutions but could not find one that matched my situation.
My attempt
df %>%
separate(col = game, into = c("year", "day", "month", "monthday", "site", "team", "decision", "runs1", "runs2", "pitcher"), sep = "[. ,-]", remove = TRUE)
Desired output (see input image)
Dput
structure(list(game = c("2021. Mon, Apr 5 at PHI L (3-5)#", "2020. Fri, Jul 24 vs ATL W (1-0)",
"2019. Thu, Mar 28 at WSN W (2-0)", "2018. Thu, Mar 29 vs STL W (9-4)",
"2017. Mon, Apr 3 vs ATL W (6-0)"), pitcher = c("deGrom", "deGrom",
"deGrom", "Syndergaard", "Syndergaard")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -5L))
I would prefer a dplyr result but am open to others.
