[R]  splitting scientific names into genus, species, and subspecies
    Mark W. Miller 
    mark_wayne_miller at yahoo.com
       
    Wed Nov  4 22:09:42 CET 2009
    
    
  
I have a list of scientific names in a data set.  I would like to split the
names into genus, species and subspecies.  Not all names include a
subspecies.  Could someone show me how to do this?
My example code is:
a <- matrix(c('genusA speciesA', 10,   
              'genusB speciesAA', 20,   
              'genusC speciesAAA subspeciesA', 15, 
              'genusC speciesAAA subspeciesB', 25), nrow=4, byrow=TRUE)
aa <- data.frame(a)
colnames(aa) <- c('species', 'counts')
aa
# The code returns
                                   species  counts
1                     genusA speciesA     10
2                    genusB speciesAA     20
3 genusC speciesAAA subspeciesA     15
4 genusC speciesAAA subspeciesB     25
# I would like there to be 4 columns as below
genus  species    subspecies    counts
genusA speciesA   no.subspecies   10
genusB speciesAA  no.subspecies   20
genusC speciesAAA subspeciesA     15
genusC speciesAAA subspeciesB     25
I have tried using 'strsplit', but cannot get the desired result.  Thank you
for any help with this.
Mark Miller
Gainesville, Florida
-- 
View this message in context: http://old.nabble.com/splitting-scientific-names-into-genus%2C-species%2C-and-subspecies-tp26204666p26204666.html
Sent from the R help mailing list archive at Nabble.com.
    
    
More information about the R-help
mailing list