How to separate a data frame column into several variables in the R programming language. More details: https://statisticsglobe.com/split-dat...
R code of this video:
data <- data.frame(x = c("a-1", "b-2", "c-3"))
##### Example 1
data.frame(do.call("rbind", strsplit(as.character(data$x), "-", fixed = TRUE)))
##### Example 2
install.packages("stringr")
library("stringr")
str_split_fixed(data$x, "-", 2)
##### Example 3
install.packages("tidyr")
library("tidyr")
data %>%
separate(x, c("col1", "col2"), "-")
On this page of the site you can watch the video online R Split Data Frame Variable into Multiple Columns (3 Examples) | Separate String | stringr vs. tidyr with a duration of hours minute second in good quality, which was uploaded by the user Statistics Globe 06 May 2020, share the link with friends and acquaintances, this video has already been watched 26,293 times on youtube and it was liked by 202 viewers. Enjoy your viewing!