Hello,
assume I have an unstructured text line from a connection. Unfortunately,
it is in string format:
R x
[1] \talpha0\t-0.638\t0.4043\t0.4043\t-2.215\t-0.5765\t-0.137\t501\t2000
How can I extract the data included in this string object x in order to
get the elements for the parameter
Try this:
na.omit(as.numeric(unlist(strsplit(\talpha0\t-0.638\t0.4043\t0.4043\t-2.215\t-0.5765\t-0.137\t501\t2000,
\t
On Fri, Jul 18, 2008 at 1:44 PM, Christine A.
[EMAIL PROTECTED] wrote:
Hello,
assume I have an unstructured text line from a connection. Unfortunately,
it is in string
Dear Christine,
Try
x=\talpha0\t-0.638\t0.4043\t0.4043\t-2.215\t-0.5765\t-0.137\t501\t2000
res=unlist(strsplit(x,[\t]))
as.numeric(res[-c(1,2,length(res)-1,length(res))])
HTH,
Jorge
On Fri, Jul 18, 2008 at 12:44 PM, Christine A.
[EMAIL PROTECTED] wrote:
Hello,
assume I have an
strapply in gsubfn finds matches of the indicated regexp,
in this case a \t followed by one or more minus, dot or digit,
and with backref of -1 it passes the backreference, i.e. portion
of the match within (..), to the function in the third arg. See
http://gsubfn.googlecode.com
library(gsubfn)
4 matches
Mail list logo