rdplyrmergefuzzyjoin

How to merge 2 dataframes with partial character strings?


i have a dataset that lists several possible genera of plants, and another dataset that lists all the species with their functional forms. I would like to merge these datasets in such a way that IF the genus listed in df2 is found within the SPP column of df1, the merged dataframe will include the functional form associated. ie if a sample is listed in df1 as possibly Poa OR Festuca, and df2 lists the functional form of Poa as Graminoid, the resultant merged dataframe would have all of the data from df1 AND an additional column that says "Graminoid." (also including the other columns such as LifeHistory and Origin would also be fine/helpful)

First Dataframe, containing multiple possible species (subset of first 100 rows):

structure(list(SPP = c("Abies", "Acer", "Poa OR Agrostis", "Allium schoenoprasum", 
"Alnus", "Amblystegiaceae OR Anomodontaceae OR Pterobryaceae OR Meteoriaceae OR Pterigynandraceae OR Lembophyllaceae OR Hypnum OR Taxiphyllaceae OR Orthostichellaceae OR Hylocomiaceae OR Leucodontaceae OR Miyabeaceae OR Climaciaceae OR Cryphaeaceae OR Calliergonaceae OR Neckeraceae OR Moss", 
"Andreaeaceae OR Moss", "Anemone", "Antennaria", "Apocynum cannabinum", 
"Aralia OR Ehretiaceae OR Araliaceae", "Arctostaphylos uva-ursi", 
"Artemisia", "Asteraceae", "Asteraceae OR Bidens OR Senecio", 
"Astragalus", "Aulacomniaceae OR Moss", "Berberis", "Betula", 
"Bidens", "Bidens OR Torricelliaceae OR Cornus OR Cardiopteridaceae", 
"Boechera", "Boechera OR Arabis", "Boykinia OR Saxifraga", "Brachytheciaceae OR Plagiotheciaceae OR Moss", 
"Brickellia", "Bromus", "Bryaceae OR Moss", "Bryaceae OR Mniaceae OR Splachnaceae OR Moss", 
"Buxbaumiaceae", "Calamagrostis", "Campanula rotundifolia", "Carex", 
"Caryophyllaceae", "Castilleja", "Celastraceae", "Celastraceae OR Paxistima", 
"Cerastium", "Chamerion  OR Epilobium OR Oenothera", "Chamerion", 
"Chrysosplenium", "Claytonia", "Clematis", "Collinsia", "Cornus", 
"Cornus OR Phacelia", "Crassulaceae", "Crepis OR Lactuca OR Centaurea OR Tragopogon OR Solidago OR Gutierrezia OR Taraxacum", 
"Danthonia californica", "Delphinium geyeri", "Dichanthelium acuminatum OR Dichanthelium oligosanthes OR Panicum capillare", 
"Dicranaceae", "Draba", "Dryas OR Purshia", "Echinacea angustifolia OR Eriophyllum lanatum OR Cornus canadensis", 
"Elaeagnus commutata", "Elymus OR Agropyron OR Triticum", "Encalyptaceae OR Moss", 
"Equisetum", "Ericaceae OR Rhododendron", "Erigeron", "Erigeron", 
"Erigeron OR Taraxacum", "Eriogonum", "Erythronium", "Erythronium OR Liliaceae", 
"Euphorbia glyptosperma", "Fabaceae", "Festuca", "Fragaria OR Rosa OR Rubus OR Sibbaldia OR Drymocallis OR Comarum OR Potentilla", 
"Funariaceae OR Moss", "Galium", "Gaultheria", "Gentiana calycosa", 
"Geranium", "Goodyera", "Grimmiaceae OR Moss", "Grimmiaceae OR Mniaceae OR Disceliaceae OR Ditrichaceae OR Drummondiaceae OR Meesiaceae OR Rhacocarpaceae OR Bryaceae OR Moss", 
"Gymnomitriaceae OR Liverwort", "Hedysarum", "Hieracium triste", 
"Hypericum", "Juncus", "Juniperus communis", "Koeleria macrantha OR Deschampsia cespitosa", 
"Lamiaceae", "Liliaceae", "Lomatium bicolor OR Shoshonea pulvinata OR Lomatium macrocarpum OR Musineon divaricatum OR Zizia aptera", 
"Lonicera", "Lotus unifoliolatus", "Luzula", "Lycopodium clavatum OR Moss", 
"Melica subulata", "Menyanthes trifoliata", "Mertensia", "Micranthes", 
"Micranthes OR Saxifraga", "Mniaceae OR Moss", "Mniaceae OR Splachnaceae OR Bartramiaceae OR Ditrichaceae OR Meesiaceae OR Rhizogoniaceae OR Moss", 
"Moneses uniflora"), comb_S026401.R1 = c(4713, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 792, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 16, 31, 0, 0, 0, 133, 0, 1649, 0, 0, 0, 
0, 0, 0, 29, 14, 0, 0, 0,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 0, 0, 0, 8, 0, 0, 
0, 0, 384, 0, 0, 0, 0, 69, 0, 0, 0, 442, 0, 0, 0, 0, 0, 228, 
0, 0, 0), comb_S026412.R1 = c(331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 31, 0, 0, 0, 0, 28, 8, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 
0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 25, 0, 14, 0, 0, 0, 0, 0, 322, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 6959, 0, 0, 0, 0, 0, 0, 
0, 17, 0, 0, 0, 0, 0, 10, 0, 0, 0), comb_S026413.R1 = c(1394, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 30, 0, 0, 0, 0, 0, 
0, 0, 21, 0, 0, 0, 0, 28, 0, 0, 0, 0, 26, 156, 0, 0, 0, 162, 
29, 41, 0, 0, 0, 0, 0, 351, 129, 0, 0, 0, 0, 0, 0, 125, 0, 0, 
0, 0, 0, 0, 44, 0, 377, 0, 0, 0, 0, 0, 1043, 0, 38, 0, 17, 0, 
0, 0, 0, 0, 0, 0, 296, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 
0, 660, 0, 0, 0), comb_S026414.R1 = c(21, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 91, 0, 0, 0, 978, 292, 52, 0, 0, 0, 0, 0, 0, 
619, 0, 0, 0, 0, 0, 0, 256, 0, 22, 0, 0, 0, 0, 194, 0, 1075, 
0, 0, 0, 0, 0, 5098, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1360, 
0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 826, 12, 0, 0, 0), comb_S026415.R1 = c(0, 
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 28, 0, 0, 
0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026416.R1 = c(271, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 
0, 0, 273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 36, 0, 0, 0, 154, 5043, 
314, 0, 0, 0, 0, 0, 11, 15, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 
0, 0, 240, 0, 228, 0, 0, 0, 0, 0, 140, 31, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 714, 0, 0, 0, 0, 26, 0, 0, 0, 222, 0, 0, 0, 0, 56, 
191, 0, 0, 0), comb_S026419.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 17, 
0, 0, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 676, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 135, 0, 0, 0, 0, 129, 142, 126, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 6521, 0, 
0, 0, 0, 0, 4088, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 412, 20, 0, 
0, 0, 0, 0, 0, 0, 116, 0, 0, 0, 0, 305, 361, 0, 0, 0), comb_S026421.R1 = c(4689, 
47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 23, 0, 0, 0, 0, 0, 
0, 0, 208, 0, 0, 0, 34, 0, 0, 111, 0, 29, 0, 38, 0, 0, 0, 113, 
37, 272, 0, 0, 0, 0, 0, 0, 286, 22, 0, 57, 0, 0, 13, 663, 0, 
0, 0, 154, 0, 29, 376, 0, 130, 0, 0, 0, 0, 0, 442, 0, 49, 0, 
191, 14, 0, 24, 0, 0, 0, 0, 2075, 187, 0, 0, 0, 102, 0, 0, 90, 
3498, 0, 0, 67, 0, 0, 16, 0, 0, 0), comb_S026422.R1 = c(95, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 135, 0, 0, 0, 0, 0, 340, 85, 
0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 178, 0, 137, 0, 0, 0, 
0, 9, 0, 1174, 0, 0, 0, 0, 0, 499, 0, 0, 0, 0, 0, 0, 28, 0, 0, 
0, 0, 588, 2692, 0, 0, 0, 33, 0, 0, 0, 12, 0, 0, 0, 0, 198, 26, 
0, 0, 0), comb_S026423.R1 = c(360, 0, 0, 0, 0, 0, 0, 0, 14, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 614, 0, 0, 0, 0, 0, 0, 
0, 0, 9, 279, 0, 0, 0, 0, 32, 251, 94, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 212, 0, 10, 0, 0, 0, 0, 0, 0, 781, 0, 0, 0, 0, 
0, 1608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1200, 0, 0, 0, 0, 76, 
0, 0, 0, 2382, 0, 0, 0, 0, 149, 259, 0, 0, 0), comb_S026427.R1 = c(666, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 
0, 356, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1545, 37, 475, 
0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, 
0, 146, 0, 116, 0, 0, 0, 0, 0, 117, 0, 0, 0, 34, 0, 0, 0, 0, 
0, 0, 0, 1062, 71, 0, 0, 0, 51, 0, 0, 0, 722, 0, 0, 0, 0, 0, 
0, 0, 0, 0), comb_S026428.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 857, 1071, 
0, 0, 1435, 0, 0, 0, 63, 0, 0, 387, 0, 0, 301, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 625, 0, 0, 
0, 0, 819, 672, 0, 0, 0, 0, 0, 0, 4313, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026429.R1 = c(21, 
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 340, 0, 0, 10, 22, 190, 
0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 252, 0, 165, 0, 0, 
0, 0, 35, 0, 124, 0, 0, 0, 0, 0, 138, 0, 0, 0, 145, 0, 0, 0, 
0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 12, 
0, 0, 0), comb_S026431.R1 = c(1545, 9, 0, 0, 0, 0, 0, 0, 10, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 303, 0, 0, 0, 0, 0, 
0, 0, 0, 8, 61, 18, 0, 0, 0, 67, 12, 69, 0, 0, 0, 0, 0, 0, 11, 
10, 0, 0, 10, 0, 0, 21, 0, 0, 0, 0, 0, 0, 10, 0, 2395, 0, 0, 
0, 0, 0, 974, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 7078, 0, 0, 0, 
0, 11, 0, 0, 0, 35, 0, 0, 0, 0, 596, 269, 0, 0, 0), comb_S026430.R1 = c(322, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 507, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 33, 0, 0, 0, 562, 6336, 
336, 0, 0, 0, 0, 0, 17, 32, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 
0, 0, 228, 0, 340, 0, 0, 0, 0, 0, 257, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 687, 11, 0, 0, 0, 65, 0, 0, 0, 167, 0, 0, 0, 0, 0, 141, 
0, 0, 0), comb_S026432.R1 = c(2878, 0, 0, 0, 0, 0, 0, 0, 8, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 19, 0, 0, 36, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 270, 45, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 36, 77, 0, 
0, 0, 0, 0, 0, 360, 0, 0, 9, 0, 0, 0, 191, 0, 488, 8, 8, 0, 0, 
0, 1428, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 852, 0, 0, 0, 0, 0, 
0, 0, 0, 22, 11, 0, 0, 0, 0, 152, 0, 0, 0), comb_S026433.R1 = c(908, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 14, 0, 0, 0, 0, 15, 0, 
0, 0, 293, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 67, 0, 0, 0, 2045, 25, 
21, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0, 300, 0, 28, 0, 0, 
0, 0, 251, 0, 564, 0, 0, 0, 0, 0, 4901, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 869, 0, 0, 0, 0, 103, 0, 0, 0, 224, 0, 0, 0, 0, 0, 
0, 0, 0, 0), comb_S026434.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 172, 0, 12, 0, 166, 1591, 50, 0, 0, 0, 0, 0, 0, 11, 
44, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 140, 0, 34, 0, 0, 0, 
0, 0, 365, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 41, 1234, 0, 0, 0, 
0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 548, 138, 0, 0, 0), comb_S026435.R1 = c(1961, 
83, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 
0, 0, 332, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 15, 0, 11, 0, 233, 890, 
69, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 
0, 0, 31, 0, 3144, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 15, 
0, 0, 0, 0, 1881, 0, 0, 0, 0, 9, 0, 0, 0, 163, 0, 0, 0, 0, 224, 
70, 0, 0, 0), comb_S026438.R1 = c(1944, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 30, 0, 0, 79, 0, 0, 0, 0, 
0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 876, 0, 0, 0, 0, 0, 0, 0, 0, 41, 
0, 0, 0, 0, 0, 0, 789, 0, 0, 0, 0, 0, 197, 814, 18, 253, 0, 0, 
0, 0, 0, 210, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 60, 0, 0, 0, 
0, 0, 0, 0, 0, 623, 0, 0, 0, 0, 474, 556, 0, 0, 0), comb_S026440.R1 = c(1955, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 0, 0, 0, 438, 1653, 
65, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 
0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 1954, 0, 16, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 30, 
0, 0, 0), comb_S026444.R1 = c(3372, 0, 0, 11, 0, 0, 0, 0, 100, 
0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 18, 0, 0, 0, 14, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 9, 251, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 38, 19, 
26, 0, 0, 0, 0, 0, 1106, 0, 0, 0, 0, 0, 22, 94, 0, 1428, 0, 0, 
0, 0, 0, 2669, 0, 31, 15, 0, 0, 0, 0, 0, 0, 0, 0, 526, 0, 0, 
0, 0, 86, 0, 0, 0, 58, 0, 0, 0, 0, 0, 541, 0, 0, 0), comb_S026447.R1 = c(0, 
0, 0, 0, 34, 17, 0, 0, 15, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 1168, 0, 0, 0, 15, 0, 0, 0, 0, 13, 41, 26, 0, 0, 0, 
187, 41, 74, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 10, 0, 1242, 0, 0, 0, 0, 0, 9354, 0, 39, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 464, 0, 0, 0, 0, 36, 0, 0, 0, 91, 0, 0, 0, 
0, 112, 79, 91, 0, 0), comb_S026450.R1 = c(0, 564, 0, 0, 10, 
0, 0, 0, 0, 8, 0, 0, 16, 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0, 710, 0, 70, 0, 66, 
365, 505, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 184, 0, 95, 
0, 0, 0, 0, 32, 0, 51, 25, 37, 0, 0, 0, 732, 0, 21, 0, 30, 0, 
0, 0, 9, 0, 0, 0, 1082, 9, 0, 0, 0, 0, 0, 43, 0, 62, 0, 13, 0, 
0, 0, 0, 0, 0, 0), comb_S026457.R1 = c(89, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 456, 10, 0, 
0, 0, 0, 0, 0, 0, 35, 253, 0, 0, 0, 0, 31, 8, 548, 0, 0, 0, 0, 
0, 0, 27, 27, 0, 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, 0, 0, 319, 
0, 0, 0, 0, 0, 6466, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1262, 0, 
0, 0, 0, 50, 0, 0, 0, 630, 0, 0, 0, 0, 50, 12, 0, 0, 0), comb_S026458.R1 = c(36, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 21, 13, 
0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 0, 0, 0, 1678, 51, 
36, 0, 0, 0, 0, 0, 0, 97, 13, 0, 0, 0, 0, 0, 543, 0, 0, 0, 0, 
0, 0, 66, 0, 505, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 1193, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 811, 0, 
0, 0, 0), comb_S026461.R1 = c(650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 8, 0, 0, 28, 0, 0, 0, 
0, 0, 9, 40, 829, 0, 0, 0, 834, 34, 16, 0, 0, 0, 0, 0, 0, 490, 
0, 0, 0, 0, 0, 0, 100, 0, 75, 0, 0, 0, 19, 0, 0, 100, 0, 0, 0, 
0, 0, 1077, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 199, 16847, 0, 0, 
0, 55, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026462.R1 = c(3645, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 12, 
0, 9, 786, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 3978, 0, 0, 0, 580, 
0, 1341, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 283, 0, 0, 
0, 0, 0, 0, 80, 0, 561, 36, 17, 0, 0, 0, 1111, 0, 0, 0, 77, 0, 
0, 0, 0, 0, 0, 0, 1805, 14, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, 0, 
0, 16, 20, 0, 0, 0), comb_S026463.R1 = c(22, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 1115, 59, 0, 0, 0, 0, 0, 
0, 0, 12, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 
0, 0, 0, 0, 468, 153, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 130, 0, 0, 0, 0, 1267, 0, 0, 0, 0), comb_S026464.R1 = c(0, 
764, 0, 0, 0, 0, 0, 0, 338, 0, 0, 96, 0, 0, 0, 0, 0, 307, 2313, 
0, 0, 0, 0, 91, 0, 0, 44, 0, 0, 0, 127, 463, 12, 37, 0, 13, 186, 
0, 35, 21, 41, 0, 0, 136, 0, 0, 0, 1019, 0, 29, 0, 0, 0, 102, 
0, 0, 0, 0, 0, 22, 0, 0, 0, 373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0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, 0, 0, 
0), comb_S026470.R1 = c(30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 1402, 0, 35, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 
0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 40, 10, 16, 0, 0, 70, 0, 0, 3301, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8085, 0, 0, 0, 0, 0, 0, 0, 0, 
22, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026471.R1 = c(6519, 0, 
0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 12, 0, 0, 
0, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 503, 0, 228, 0, 85, 200, 
156, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 17, 10, 0, 0, 0, 522, 0, 42, 0, 51, 0, 0, 0, 0, 
0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 311, 0, 0, 0, 0, 8, 0, 0, 
0, 0), comb_S026473.R1 = c(26, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 
0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 355, 0, 0, 0, 0, 0, 0, 0, 
31, 57, 633, 9, 0, 0, 0, 577, 68, 119, 0, 0, 0, 0, 0, 0, 31, 
0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 15, 15, 0, 868, 0, 0, 0, 
0, 0, 3912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 447, 0, 0, 0, 0, 
0, 0, 0, 0, 140, 0, 0, 0, 0, 778, 1379, 0, 0, 0), comb_S026474.R1 = c(0, 
2046, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 54, 0, 0, 0, 0, 0, 672, 
0, 0, 0, 0, 338, 0, 0, 14, 0, 0, 0, 0, 159, 168, 0, 0, 0, 55, 
218, 0, 0, 12, 0, 0, 0, 98, 0, 0, 262, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 53, 0, 0, 0, 0, 0, 319, 0, 0, 0, 0, 0, 179, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 71), comb_S026476.R1 = c(1181, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 10, 0, 0, 1077, 0, 0, 0, 
0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 66, 529, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 43, 0, 0, 519, 0, 0, 0, 40, 0, 0, 47, 0, 193, 
0, 0, 0, 0, 0, 1435, 0, 0, 0, 0, 0, 0, 99, 0, 47, 0, 29, 167, 
32, 58, 0, 0, 0, 0, 0, 0, 1029, 0, 0, 0, 0, 410, 0, 0, 0, 0), 
    comb_S026477.R1 = c(53, 0, 10, 0, 0, 0, 0, 0, 43, 0, 0, 0, 
    21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 892, 0, 0, 11, 0, 0, 0, 
    33, 0, 13, 0, 9, 0, 151, 0, 25, 89, 66, 15, 0, 0, 0, 0, 79, 
    22, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 
    0, 0, 0, 0, 177, 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 963, 36, 0, 0, 0), 
    comb_S026483.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 22, 21, 49, 12, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 134, 0, 0, 0, 68, 1175, 18, 0, 0, 0, 0, 0, 0, 0, 94, 
    0, 0, 0, 0, 20, 0, 689, 0, 12, 0, 0, 0, 0, 97, 0, 288, 0, 
    0, 0, 0, 0, 280, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 204, 0, 0, 0, 0, 28, 76, 0, 0, 0), comb_S026484.R1 = c(170, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 302, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 
    153, 166, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 
    0, 0, 0, 0, 0, 0, 21, 0, 750, 0, 0, 0, 0, 0, 8851, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 952, 0, 0, 0, 0, 0, 0, 0, 0, 1330, 
    0, 0, 0, 0, 33, 1330, 0, 0, 0), comb_S026485.R1 = c(37, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 
    0, 0, 78, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 1570, 
    57, 69, 14, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 291, 0, 
    0, 0, 0, 0, 0, 59, 0, 394, 0, 0, 0, 0, 0, 6387, 0, 0, 0, 
    0, 0, 0, 13, 0, 0, 0, 0, 2119, 31, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 962, 0, 0, 0, 0), comb_S026488.R1 = c(73, 0, 
    0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 215, 
    867, 168, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 33, 0, 
    0, 0, 0, 0, 0, 0, 0, 1101, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 
    10, 0, 25, 0, 0, 0, 0, 258, 0, 0, 0, 0, 0, 0, 0, 0, 282, 
    0, 0, 0, 0, 4219, 0, 0, 0, 0), comb_S026489.R1 = c(25, 17, 
    0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 49, 463, 83, 0, 0, 0, 
    331, 74, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206, 
    0, 0, 0, 0, 0, 0, 97, 0, 2031, 0, 0, 0, 0, 0, 227, 0, 0, 
    16, 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 0, 
    616, 0, 0, 0, 0, 4429, 2526, 0, 0, 0), comb_S026490.R1 = c(19, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 
    24, 552, 333, 0, 0, 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 18, 
    0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3654, 60, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 433, 0, 0, 0, 0, 0, 0, 0, 0, 907, 
    0, 0, 0, 0, 1561, 0, 0, 38, 0), comb_S026493.R1 = c(3353, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 
    0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 13, 0, 0, 22, 129, 0, 0, 
    0, 87, 216, 145, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 
    221, 0, 0, 0, 0, 0, 8, 133, 0, 344, 0, 0, 0, 0, 0, 59, 0, 
    0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 4523, 0, 8, 0, 0, 49, 0, 0, 
    0, 150, 0, 0, 0, 0, 0, 38, 0, 0, 0)), row.names = c(NA, 100L
), class = "data.frame")

second dataframe, containing functional classes(subset of first 200 rows):

structure(list(CODE = c("AGOSSP", "ALYALY", "ARABSP", "ARESER", 
"BUPAME", "CALLSP", "CENSTO", "CERNUT", "CIRSCA", "CLAPER", "CLAPUL", 
"CLARUB", "COLGRA", "COLLIN", "COLPAR", "CYNOFF", "DESCSP", "DESSOP", 
"DRABSP", "DRAREP", "EPIBRA", "GALAPA", "GALBIF", "GAYHUM", "GENAMA", 
"GERBIC", "GERVIS", "HOLUMB", "LACSER", "LAMAMB", "LAPRED", "LAPSQU", 
"LOGARV", "MADEXI", "MADISP", "MEDLUP", "MELLIN", "MELOFF", "MICGRA", 
"MINRUB", "MONPAR", "MYOSTR", "OROUNI", "ORTTEN", "PHAFRA", "PHALIN", 
"POLDOU", "POLMIN", "PULDOU", "THLARV", "TRADUB", "TRIAUR", "VERARV", 
"VERTHA", "VERVER", "AVEFAT", "BROARV", "BROBRI", "BROJAP", "BROTEC"
), NameScientific = c("Agoseris sp", "Alyssum alyssoides", "Arabis sp", 
"Arenaria serpyllifolia", "Bupleurum americanum", "Callitriche sp", 
"Centaurea stoebe", "Cerastium nutans", "Cirsium scariosum", 
"Claytonia perfoliata", "Clarkia pulchella", "Claytonia rubra", 
"Collomia grandiflora", "Collomia linearis", "Collinsia parviflora", 
"Cynoglossum officinale", "Descurainia sp", "Descurainia sophia", 
"Draba sp", "Draba reptans", "Epilobium brachycarpum", "Galium aparine", 
"Galium bifolium", "Gayophytum humile", "Gentianella amarella", 
"Geranium bicknellii", "Geranium viscosissimum", "Holosteum umbellatum", 
"Lactuca serriola", "Lamium amplexicaule", "Lappula redowskii", 
"Lappula squarrosa", "Logfia arvensis", "Madia exigua", "Madia sp", 
"Medicago lupulina", "Melampyrum lineare", "Melilotus officinalis", 
"Microsteris gracilis", "Minuartia rubella", "Montia parvifolia", 
"Myosotis stricta", "Orobanche uniflora", "Orthocarpus tenuifolius", 
"Phacelia franklinii", "Phacelia linearis", "Polygonum douglasii", 
"Polygonum minimum", "Polygonum douglasii", "Thlaspi arvense", 
"Tragopogon dubius", "Trifolium aureum", "Veronica arvensis", 
"Verbascum thapsus", "Veronica verna", "Avena fatua", "Bromus arvensis", 
"Bromus briziformis", "Bromus japonicus", "Bromus tectorum"), 
    Genus = c("Agoseris", "Alyssum", "Arabis", "ARENARIA", "Bupleurum", 
    "Callitiriche", "Centaurea", "Cerastium", "Cirsium", "Claytonia", 
    "Clarkia", "Claytonia", "Collomia", "Collomia", "Collinsia", 
    "Cynoglossum", "Descurainia", "Descurainia", "Draba", "DRABA", 
    "Epilobium", "Galium", "Galium", "Gayophytum", "GENTIANELLA", 
    "GERANIUM", "Geranium", "Holosteum", "Lactuca", "Lamium", 
    "Lappula", "Lappula", "Logfia", "Madia", "MADIA", "Medicago", 
    "Melampyrum", "Melilotus", "Microsteris", "MINUARTIA", NA, 
    "Myosotis", "Orobanche", "ORTHOCARPUS", "Phacelia", "Phacelia", 
    "Polygonum", "POLYGONUM", "Polygonum", "Thlaspi", "Tragopogon", 
    "Trifolium", "Veronica", "Verbascum", "Veronica", "Avena", 
    "BROMUS", "Bromus", "Bromus", "Bromus"), Species = c("sp", 
    "alyssoides", "sp", "SERPYLLIFOLIA", "americanum", "sp", 
    "stoebe", "nutans", "scariosum", "perfoliata", "pulchella", 
    "rubra", "grandiflora", "linearis", "parviflora", "officinale", 
    "sp", "sophia", "sp", "REPTANS", "brachycarpum", "aparine", 
    "bifolium", "humile", "AMARELLA", "BICKNELLII", "viscosissimum", 
    "umbellatum", "serriola", "amplexicaule", "redowskii", "squarrosa", 
    "arvensis", "exigua", "SP", "lupulina", "lineare", "officinalis", 
    "gracilis", "RUBELLA", NA, "stricta", "uniflora", "TENUIFOLIUS", 
    "franklinii", "linearis", "douglasii", "MINIMUM", "douglasii", 
    "arvense", "dubius", "aureum", "arvensis", "thapsus", "verna", 
    "fatua", "ARVENSIS", "briziformis", "japonicus", "tectorum"
    ), Family = c("Asteraceae", "Brassicaceae", "Brassicaceae", 
    "Caryophyllaceae", "Apiaceae", "Callitrichaceae", "Asteraceae", 
    "Caryophyllaceae", "Asteraceae", "Montiaceae", "Onagraceae", 
    "Montiaceae", "Polemoniaceae", "Polemoniaceae", "Plantaginaceae", 
    "Boraginaceae", "Brassicaceae", "Brassicaceae", "Brassicaceae", 
    "Brassicaceae", "Onagraceae", "Rubiaceae", "Rubiaceae", "Onagraceae", 
    "Gentianaceae", "Gerianaceae", "Geraniaceae", "Caryophyllaceae", 
    "Asteraceae", "Lamiaceae", "Boraginaceae", "Boraginaceae", 
    "Asteraceae", "Asteraceae", "Asteraceae", "Fabaceae", "Orobanchaceae", 
    "Fabaceae", "Polemoniaceae", "Caryophyllaceae", NA, "Boraginaceae", 
    "Orobanchaceae", "Scrophulariaceae", "Hydrophyllaceae", "Hydrophyllaceae", 
    "Polygonaceae", "Polygonaceae", "Polygonaceae", "Brassicaceae", 
    "Asteraceae", "Fabaceae", "Plantaginaceae", "Scrophulariaceae", 
    "Plantaginaceae", "Poaceae", "Poaceae", "Poaceae", "Poaceae", 
    "Poaceae"), Form = c("Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", 
    "Forb", "Forb", "Graminoid", "Graminoid", "Graminoid", "Graminoid", 
    "Graminoid"), LifeHistory = c("Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual", "Annual", "Annual", "Annual", 
    "Annual", "Annual", "Annual"), Origin = c("Native", "Exotic", 
    "Native", "Exotic", "Native", "UNK", "Exotic", "Native", 
    "Native", "Native", "Native", "Native", "Native", "Native", 
    "Native", "Exotic", "UNK", "Exotic", "Native", "Native", 
    "Native", "Native", "Native", "Native", "Native", "Native", 
    "Native", "Exotic", "Exotic", "Exotic", "Native", "Exotic", 
    "Exotic", "Native", "Native", "Exotic", "Native", "Exotic", 
    "Native", "Native", "Native", "Exotic", "Native", "Native", 
    "Native", "Native", "Native", "Native", "Native", "Exotic", 
    "Exotic", "Exotic", "Exotic", "Exotic", "Exotic", "Exotic", 
    "Exotic", "Exotic", "Exotic", "Exotic"), C_Value = c(NA, 
    "0", NA, "0", "5", NA, "0", "4", "5", "3", "4", "4", NA, 
    "4", "3", "0", NA, "0", NA, NA, "4", "3", NA, NA, "4", "3", 
    "4", "0", "0", "1", NA, "1", "0", NA, NA, "0", "6", "0", 
    "3", "5", "5", "0", "4", "4", NA, "3", "4", "5", "4", "0", 
    "0", "0", "0", "0", "1", "1", "1", "1", "0", "0"), X = c("", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "")), row.names = c(NA, 
60L), class = "data.frame")

I'm very new to r- i've been trying to figure out if some part of fuzzyjoin could work, also using ore simple %in% to try and merge... but generally pretty lost


Solution

  • The following code merges the two data.frames by SPP and Genus after splitting SPP by the separator "OR" and creating a temporary data set with one row per unique value of SPP.
    It uses packages dplyr and tidyr.

    library(dplyr)
    
    spp <- strsplit(df1$SPP, "OR")
    spp <- lapply(spp, trimws)
    
    spp_len <- sapply(spp, length)
    new_row <- rep(NA_character_, max(spp_len))
    names(new_row) <- sprintf("SPP_%d", seq_len(max(spp_len)))
    result <- t(mapply(\(x, n) {
      if(length(x)) new_row[1:n] <- x
      new_row
    }, spp, spp_len)) %>%
      as.data.frame()
    rm(new_row)
    
    result <- result %>%
      bind_cols(df1[-1]) %>%
      tidyr::pivot_longer(starts_with("SPP"), values_to = "SPP") |>
      select(-name) %>%
      relocate(SPP) %>%
      tidyr::drop_na() %>%
      left_join(df2, by = c("SPP" = "Genus"))
    
    str(result)