Message-ID: <4A2136E6.5040906@statistik.tu-dortmund.de>
Date: 2009-05-30T13:38:46Z
From: Uwe Ligges
Subject: strsplit
In-Reply-To: <da79af330905291022l671e7718i3171421e9e7040a2@mail.gmail.com>
Henrique Dallazuanna wrote:
> Try this:
>
> unlist(part)[1]
>
> or
>
> part[[1]][1]
And in order to isnpect your objects, use
str(part)
at first which tells you about the structure of the object. Then you
know you got a list and can look up how to extract a part of a list as
Henrique Dallazuanna ponted out already.
Uwe Ligges
> On Fri, May 29, 2009 at 2:09 PM, Nair, Murlidharan T <mnair at iusb.edu> wrote:
>
>> I am trying split a string and use one part of it to label graphs. I am
>> using strsplit for that. While I am able to split it, how do I access the
>> separated parts.
>>> filName<-"chrI_2223"
>>> part<- strsplit(filName,"\\_")
>> > part
>> [[1]]
>> [1] "chrI" "2223"
>>> part[1]
>> [[1]]
>> [1] "chrI" "2223"
>>
>> I looked up the help archive but did not find it. Can someone help me here?
>>
>> Cheers../Murli
>>
>>
>> [[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.
>>
>
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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.