or strsplit?
test <-"k0298_7832_8964"
# Split and remove letters
test <- unlist(strsplit(test, "\\_"))
test <- gsub("[a-z]", "", test[1])
# Split on letters and underscore
test <-"k0298_7832_8964"
test <- unlist(strsplit(test, "[a-z]|\\_"))
test[2]
On Thu, 18 Feb 2016 at 18:43 Ben Tupper wrot
Hi,
Will substring work for you?
?substring
Cheers,
Ben
> On Feb 18, 2016, at 12:36 PM, Marine Regis wrote:
>
> Hello,
>
>> From this character string:
>
> test <-"k0298_7832_8964"
>
> how can I obtain:
>
> [[1]]
>
> "0298"
>
> Thank you very much for your help.
>
> [[alternati
2 matches
Mail list logo