Re: [R] How to cut data elements included in a text line

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Fri, 18 Jul 2008 15:07:14 -0300

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. <adrion_at_ibe.med.uni-muenchen.de> wrote:
>
> 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 vector called "alpha0", i.e.
> -0.638 0.4043 0.0467 0.4043 -2.215 -0.5765 -0.137 501
>
>
> Any hints how to handle this would be appreciated.
> Best regards,
> Christine
>
>
> --
> Christine Adrion, Dipl.-Stat., MPH
>
> Ludwig-Maximilians-Universitaet Muenchen
> IBE - Institut fuer Medizinische Informations-
> verarbeitung, Biometrie und Epidemiologie
> Marchioninistr. 15
> D- 81377 Muenchen
>
> Tel.: +49 (0)89 7095 - 4483
> eMail: adrion_at_ibe.med.uni-muenchen.de
> web: http://ibe.web.med.uni-muenchen.de
>
>
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/How-to-cut-data-elements-included-in-a-text-line-tp18533319p18533319.html
> Sent from the R help mailing list archive at Nabble.com.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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 Fri 18 Jul 2008 - 18:11:59 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 Fri 18 Jul 2008 - 18:31:57 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