You can always use regular expressions:
> x <- "Condition: 311"
> as.integer(sub(".*?(\\d +).*", "\\1 ", x,
perl=TRUE))
[1] 311
>
On Fri, May 8, 2009 at 10:16 AM, Matthias Gondan wrote:
> Dear list,
>
> Apparently, there is no function like sscanf in R.
>
> I have a string, "Condition: 311", an
Dear list,
Apparently, there is no function like sscanf in R.
I have a string, "Condition: 311", and I would like
to read out the number and store it to a numeric
variable. Is there an easy way to do this?
Best wishes,
Matthias
--
__
R-help@r-project
2 matches
Mail list logo