14.4.3 Diagnosing widening problems
BioinfGuru opened this issue · 0 comments
BioinfGuru commented
Hey,
Great book... love it!
I'm just learning this part of the book and there seems to be a strange behaviour of too_few()
with delim = "-"
when included on a debugged data frame: the full string is added to column x. It caused me a lot of confusion when studying this section. I'm not sure if this is my lack of understanding or not, but it might be appropriate to add a warning to remove the line of code too_few = "debug"
after debugging.
df <- tibble(x = c("1-1-1", "1-1-2", "1-3-1", "1-3-2", "1-1-1")) #debugged
df |>
separate_wider_delim(
x,
delim = "-", # <- unexpected behaviour
names = c("x", "y", "z"),
too_few = "debug"
)
df <- tibble(x = c("a10.1.2022", "b10.2.2011", "e15.1.2015")) # debugged
df |>
separate_wider_delim(
x,
delim = ".", # <- expected behaviour
names = c("code", "edition", "year"),
too_few = "debug"
)
Regards,
Kenneth