install.packages("dplyr")
library(dplyr)
id <- c(1:10)
name <- c("John Mendes", "Rob Stewart", "Rachel Abrahamson", "Christy Hickman", "Johnson Harper", "Candace Miller", "Carlson Landy", "Pansy Jordan", "Darius Berry", "Claudia Garcia")
job_title <- c("Professional", "Programmer", "Management", "Clerical", "Developer", "Programmer", "Management", "Clerical", "Developer", "Programmer")
employee <- data.frame(id, name, job_title)
separate(employee, name,into=c('first_name','last_name'),sep=' ')
Asked
Active
Viewed 22 times
0

duckmayr
- 16,303
- 3
- 35
- 53

Priyason Pauldurai
- 11
- 4
-
4Presumably that's the `separate` function from `tidyr`, which you'd need to load with `library(tidyr)` or `library(tidyverse)`. – Jon Spring May 16 '21 at 15:40
-
1@JonSpring, seems a little silly, but you might as well post that as the answer. – Ben Bolker May 16 '21 at 15:41