<code>item<-c("A","B")
Type<-c("P400","1200C")
> test_df<-data.frame(item, Type)
> test_df
item Type
1 A P400
2 B 1200C
test_df<-test_df |> tidyr::separate(Type, into = c("A", "B"), sep = "(?<=[0-9])(?=[A-Za-z])")
> test_df
item A B
1 A P400 <NA>
2 B 1200 C
</code>
<code>item<-c("A","B")
Type<-c("P400","1200C")
> test_df<-data.frame(item, Type)
> test_df
item Type
1 A P400
2 B 1200C
test_df<-test_df |> tidyr::separate(Type, into = c("A", "B"), sep = "(?<=[0-9])(?=[A-Za-z])")
> test_df
item A B
1 A P400 <NA>
2 B 1200 C
</code>
item<-c("A","B")
Type<-c("P400","1200C")
> test_df<-data.frame(item, Type)
> test_df
item Type
1 A P400
2 B 1200C
test_df<-test_df |> tidyr::separate(Type, into = c("A", "B"), sep = "(?<=[0-9])(?=[A-Za-z])")
> test_df
item A B
1 A P400 <NA>
2 B 1200 C
Hi all, with tidyr::separate
, I am able to split test_df$Type into number and text, the code splits 1200C into 1200 & C, however, for P400, I would have expected P & 400, yet NA is returned. Can you please give me a hand? Cheers.