[R] Substring of a character column
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Aug 4 12:27:38 CEST 2010
On Wed, Aug 4, 2010 at 6:00 AM, LogLord <nils.schoof at web.de> wrote:
>
> Hi,
>
> I have a dataframe with a rather complicated descriptive column (V9):
>
>> test3[(1:3), ]
> V1 V4 V5
> 10 1 4559 7173
> 17 1 58954 59871
> 19 1 357522 358458
>
> V9
> 10 ID=NM_182905.1;Name=NM_182905;Alias=FLJ00038;Note=hypothetical protein
> LOC375690
> 17 ID=NM_001005484;Alias=OR4F5;Note=olfactory receptor%2C family 4%2C
> subfamily F
> 19 ID=NM_001005224.1;Name=NM_001005224;Alias=OR4F3;Note=olfactory
> receptor%2C family 4%2C subfamily F
>>
>
> I have problems to extract two strings from this column (V9). First I need
> the "ID=..." and second I need the "Alias=..." both in seperate columns. I
> tried it with substr() but due to the different length and no wildcard
> allowance it did not work.
>
A similar question was asked last month. See:
http://permalink.gmane.org/gmane.comp.lang.r.general/197059
and the other posts in the same thread for other solutions.
More information about the R-help
mailing list