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
> sub_001                         0
> sub_001                         24
> sub_002                         0
> sub_002                        24
> sub_003                         0
> sub_003                        24
> sub_004                         0
> sub_005                        24
> ..
> ..
>
> is there a way for me to just extract the numeric numbers from the ID
> column, omitting sub_?
>
> thanks,
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/extract-number-from-a-mixture-of-character-and-number-tp4636659.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to