I have a character string from which I want to get just the numerical values
> head(temp.list)
[1] "A01: 24095" "A02: 31130" "A03: 39420" "A04: 41690" "A05: 37430" "A06: 36490"
I can use strsplit to get a list
>split.temp.list <- strsplit(temp.list, ":")
>head(split.temp.list)
[[1]]
[1] "A01" " 24095"
[[2]]
[1] "A02" " 31130"
Then, to extract the numbers into a vector, I am doing
data.values <- vector()
for (j in 1:length(split.temp.list))
data.values <- c(data.values, split.temp.list[[j]][2])
> head(data.values)
[1] " 24095" " 31130" " 39420" " 41690" " 37430" " 36490"
Is there a more efficient way of subsetting to achieve the last step (ie., creating data.values)?
I am getting back to R after years away, so thanks for helping me get back up to speed!