So this is what one of my column looks like :
| Infos |
|---|
| NAME: ANGELA SURNAME:SMITH AGE:22 CITY: LA |
| NAME: ANDREW SURNAME: D'ONOFRIO AGE:47 CITY: NYC |
I'd like to create four columns :
| NAME | SURNAME | AGE | CITY |
|---|---|---|---|
| ANGELA | SMITH | 22 | LA |
| ANDREW | D'ONOFRIO | 47 | NYC |
I read that we can use "separate" from tidyverse, and this what i tried.
library(tidyr)
library(tidyverse)
df <- infos %>% separate(Infos, c("NAME", "SURNAME","AGE","CITY"))
But this is the output :
| NAME | SURNAME | AGE | CITY |
|---|---|---|---|
| NAME | ANGELA | SURNAME | SMITH |
| NAME | ANDREW | SURNAME | D'ONOFRIO |
Then i'd like to understand how to make R knows what it has to separate. Maybe that this exact topic have been treated here before (but i didn't find it) so feel free to redirect me if necessary !