[R] split character vector by multiple keywords simultaneously
    sunny 
    sunayan at gmail.com
       
    Thu May  5 01:08:40 CEST 2011
    
    
  
Hi. I have a character vector that looks like this:
> temp <- c("Company name: The first company General Manager: John Doe I
> Managers: John Doe II, John Doe III","Company name: The second company
> General Manager: Jane Doe I","Company name: The third company Managers:
> Jane Doe II, Jane Doe III")
> temp
[1] "Company name: The first company General Manager: John Doe I Managers:
John Doe II, John Doe III"
[2] "Company name: The second company General Manager: Jane Doe I"                                   
[3] "Company name: The third company Managers: Jane Doe II, Jane Doe III" 
I know all the keywords, i.e. "Company name:", "General Manager:",
"Managers:" etc. I'm looking for a way to split this character vector into
multiple character vectors, with one column for each keyword and the
corresponding values for each, i.e.
        Company name          General Manager                  Managers
1  The first company            John Doe I                John Doe II, John
Doe III
2 The second company        Jane Doe I                          
3  The third company                                          Jane Doe II,
Jane Doe III
I have tried a lot to find something suitable but haven't so far. Any help
will be greatly appreciated. I am running R-2.12.1 on x86_64 linux.
Thanks.
--
View this message in context: http://r.789695.n4.nabble.com/split-character-vector-by-multiple-keywords-simultaneously-tp3497033p3497033.html
Sent from the R help mailing list archive at Nabble.com.
    
    
More information about the R-help
mailing list