I have a data frame where one column contains a range (or ranges) of numbers. I would like to turn this into a list of numbers based of the given range.
Example input:>
we use substr to extract parts of string to get beginning and end of numeric list. we use as.numeric to convert strings extracted to numbers. we use the colon to create the list of numbers . it will also work for multiple parts of list
> input
[1] "35-40"
> instart=substr(input,1,2)
> instart
[1] "35"
> inend=substr(input,4,5)
> inend
[1] "40"
> newlist=as.numeric(instart):as.numeric(inend)
> newlist
[1] 35 36 37 38 39 40