Hi guys, while programming I just noticed this behavior of the separate function I cannot really explain.
I'm not a programmer, just a statistician using R, so I decided to report it here for understanding.
df <- data.frame(vector = paste0("what.in.tarnation", c(1:10)))
df %>% separate(vector, c("a", "b", "c"))
so far it is working good, buf if sor some reason I specify the sepator as the dot, well things get weird.
df <- data.frame(vector = paste0("what.in.tarnation", c(1:10)))
df %>% separate(vector, c("a", "b", "c"), sep =".")
I get the warning "Warning message: Expected 3 pieces. Additional pieces discarded in 10 rows [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]." and clearly the output is wrong.
Strange enough, it is only the dot to give this problem. With a comma, everything is fine.
df <- data.frame(vector = paste0("what,in,tarnation", c(1:10)))
df %>% separate(vector, c("a", "b", "c"), sep = ",")
Any possible explanation?