[R] How to parsing data like this in R

Henrique Dallazuanna wwwhsd at gmail.com
Tue Sep 29 15:03:59 CEST 2009


Try this:

Str <- ":[Anna 'moi =) akku loppu joskus 4ltä. Kestää kauan
nää..'\tAmer, Tuusula (0:20)\t20\t12\t16\t00\t00\t11]/Anne 'Ei
jakoa,uus päivä muistio et 4n niin peruin. Hups'\t
(0:16)\t0\t12\t18\t00\t00\t11/Elina 'Konsertissa. En tod. vastaa
teille'\tEtu-Töölö, Helsinki (2:40)\t24\t12\t18\t00\t00\t11"
scan(textConnection(Str), sep = "/", what = "")

On Tue, Sep 29, 2009 at 9:56 AM, Tammy Ma <metal_licaling at live.com> wrote:
>
> Hi, R-users,
>
> I met a problem:
>
> Items:[Anna 'moi =) akku loppu joskus 4ltä. Kestää kauan nää..'\tAmer, Tuusula (0:20)\t20\t12\t16\t00\t00\t11]/Anne 'Ei jakoa,uus päivä muistio et 4n niin peruin. Hups'\t (0:16)\t0\t12\t18\t00\t00\t11/Elina 'Konsertissa. En tod. vastaa teille'\tEtu-Töölö, Helsinki (2:40)\t24\t12\t18\t00\t00\t11
>
> I want to parsing the above data into the below according to each "/":
>
>
> [Anna 'moi =) akku loppu joskus 4ltä. Kestää kauan nää..'\tAmer, Tuusula (0:20)\t20\t12\t16\t00\t00\t11]
> Anne 'Ei jakoa,uus päivä muistio et 4n niin peruin. Hups'\t (0:16)\t0\t12\t18\t00\t00\t11
> Elina 'Konsertissa. En tod. vastaa teille'\tEtu-Töölö, Helsinki (2:40)\t24\t12\t18\t00\t00\t11
>
> My problem is "/" may also appear in either of above 3 strings so I can't use "strsplit". But I having trying to use regular expression. But I still can't figure out how can I implement it into what I want? Any suggestion?
>
>
>
> Kind regards,
> Tammy
>
>
>
> _________________________________________________________________
> Windows Live™: Keep your life in sync. Check it out!
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
>        [[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




More information about the R-help mailing list