Supose I have the following
l="1,2,3,4,5"
How do I get the sequence of numeric values
1 2 3 4 5
I’ve already seen this example https://statisticsglobe.com/convert-character-to-numeric-in-r/ But it doesn’t quite match with the problem above.
>Solution :
This is one way of doing this:
library(stringr)
l="1,2,3,4,5"
as.numeric(str_split(l, ',', simplify = TRUE))