Hi,
There are lots; the best choice depends on whether your ID values
always start with "sub_" or not, and you aren't clear. Here's a
general case:
testdata <- c("sub_001", "sub_002", "sub_003")
gsub("[^0-9]", "", testdata)
You can use as.numeric() to convert them if desired.
If you use dput()
Hi,
Check ?gsub and the examples there. Here is a piece of code to get you
started:
> s <- "sub_001"
> gsub("sub_", "", s)
[1] "001"
HTH,
Jorge.-
On Mon, Jul 16, 2012 at 12:04 PM, york8866 <> wrote:
> Hi, all,
>
> I have a column like the following:
> ID TIME
Hi, all,
I have a column like the following:
ID TIME
sub_001 0
sub_001 24
sub_002 0
sub_00224
sub_003 0
sub_00324
sub_004
3 matches
Mail list logo