How to convert to numeric a sequence saved as a string?
Let's have the string "3:7". I would like to get either c(3,4,5,6,7), or 3:7, anyway with R reading this data as numeric, not as string.
If I do as.numeric("3:7") I get a NA. Is there any simple way or function in R doing this?
A more complex example:
rec_pairs <- list(c("3:7", "1"), c("2,1", "3"), c("NA", "5"), c("6", "NA"))
I am interested in obtaining all the distinct elements in the first components of the vectors of the list, that is, 3,4,5,6,7,2,1,NA,6.