[R] numbers as part of long character

From: Hua Li <hualihua_at_yahoo.com>
Date: Thu, 12 Jun 2008 13:46:12 -0700 (PDT)


I'm looking for some way to pick up the numbers which are contained and buried in a long character.

For example,


num.char = unlist(strsplit(unlist(strsplit(unlist(strsplit(unlist(strsplit(unlist(strsplit(outtree.new,")",fixed=TRUE)),"(",fixed=TRUE)),":",fixed=TRUE)),",",fixed=TRUE)),";",fixed=TRUE))


# "B" "1204.25" "E" "1204.25" "7581.11" "F" "8785.36" "8353.85" "C" "17139.21" ""

# NA 1204.25 NA 1204.25 7581.11 NA 8785.36 8353.85 NA 17139.21

would help me get the numbers such as 1204.25, 7581.11, etc, but with a warning message which reads: "Warning message:
NAs introduced by coercion "

Is there a way to get around this? Thanks!


R-help_at_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. Received on Thu 12 Jun 2008 - 21:03:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 21:31:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive