I am trying to tidy a data set by using pivot_wider but I run into some problems which I don't know how to tackle. In my values column "OrigValueStr", the one I assign to "values_from", I have both numbers and factors. As there are some duplicates, I want to get a mean from the numeric values but I want to keep the factors as factors (perhaps by placing possible duplicates after each other separated by ";" or "_", or by just keeping the first one r runs into and dropping the others). My idea is to put an ifelse statement into "values_fn" or to assign which factors from "names_from" to take a mean from and to leave the rest. However, I don't know how to accomplish this.
Another idea I have is to divide the data set into two, one which contains the numeric values and one which contains the factors (from the "values_from" column), do what needs to be done and then put the data sets together again. But I would prefer to do it all at once with pivot_wider.
As I am not very skilled in R, I don't know how to write my code so that it performs what I want. I have not found any examples of others using values_fn the way I imagine that I want to do.
Is there anyone how can point me in the right direction/help me on how to tidy this data? What I want to have is one species ("AccSpeciesName") per row (only one row per species) and every unique "TraitName" as a column.
These are things I have tried before trying my new ideas, an they do not give me what I want:
df7<-Df_TR %>%
group_by(AccSpeciesName) %>%
mutate(row = row_number()) %>%
tidyr::pivot_wider(names_from = TraitName, values_from = OrigValueStr) %>%
select(-row)
levels(D_TRY$TraitName)
df8<-Df_TR %>%
mutate(OrigValueStr = as.numeric(OrigValueStr)) %>%
pivot_wider(., names_from = TraitName, values_from = OrigValueStr,values_fn = list(OrigValueStr = mean))
Here is a subset of my data (the original one have >2 000 000 observations and 27 variables and was received from the TRY plant trait database), were I have selected the 3 variables I am interested in:
structure(list(AccSpeciesName = structure(c(1L, 1L, 2L, 2L, 3L,
3L, 5L, 5L, 6L, 7L, 11L, 11L, 9L, 10L, 12L, 12L, 13L, 13L, 15L,
17L, 18L, 18L, 19L, 20L, 21L, 21L, 22L, 22L, 23L, 23L, 24L, 24L,
25L, 25L, 26L, 27L, 27L, 28L, 29L, 4L, 8L, 14L, 28L, 16L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L
), .Label = c("Achillea millefolium", "Angelica sylvestris",
"Anthriscus sylvestris", "Calluna vulgaris", "Caltha palustris",
"Carex rostrata", "Carex vaginata", "Clematis vitalba", "Deschampsia cespitosa",
"Elymus repens", "Epilobium angustifolium", "Filipendula ulmaria",
"Geranium sylvaticum", "Helianthemum nummularium", "Lathyrus pratensis",
"Ligustrum vulgare", "Luzula multiflora", "Melampyrum sylvaticum",
"Orthilia secunda", "Persicaria vivipara", "Rhinanthus minor",
"Rubus saxatilis", "Rumex obtusifolius", "Solidago virgaurea",
"Tanacetum vulgare", "Trifolium pratense", "Trollius europaeus",
"Vaccinium myrtillus", "Vicia cracca"), class = "factor"), TraitName = structure(c(4L,
5L, 4L, 5L, 4L, 5L, 4L, 5L, 5L, 5L, 4L, 5L, 5L, 5L, 4L, 5L, 4L,
5L, 5L, 5L, 4L, 5L, 5L, 5L, 4L, 5L, 4L, 5L, 4L, 5L, 4L, 5L, 4L,
5L, 5L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
1L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 3L, 2L,
1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 1L, 3L, 2L, 1L, 2L, 1L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 1L, 3L, 2L, 1L, 3L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 2L, 1L, 3L, 2L, 3L, 2L, 1L, 2L, 1L, 3L, 2L,
1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L,
3L, 2L, 1L, 2L, 1L, 3L, 2L, 1L, 3L, 1L, 2L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
1L, 3L, 2L, 1L, 3L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L,
1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L,
2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 3L, 2L, 1L,
3L, 2L, 1L, 3L, 2L, 1L, 2L, 1L, 3L, 2L, 1L, 3L), .Label = c("Leaf area per leaf dry mass (specific leaf area, SLA or 1/LMA): petiole excluded",
"Leaf area per leaf fresh mass (specific leaf area (SLA or 1/LMA) based on leaf fresh mass)",
"Leaf dry mass per leaf fresh mass (leaf dry matter content, LDMC)",
"Plant lifespan (longevity)", "Plant nitrogen(N) fixation capacity",
"Seed dry mass"), class = "factor"), OrigValueStr = structure(c(346L,
345L, 346L, 345L, 346L, 345L, 346L, 345L, 345L, 345L, 346L, 345L,
345L, 345L, 346L, 345L, 346L, 345L, 344L, 345L, 343L, 345L, 345L,
345L, 343L, 345L, 346L, 345L, 346L, 345L, 346L, 345L, 346L, 345L,
344L, 346L, 345L, 345L, 344L, 1L, 3L, 4L, 2L, 100L, 170L, 204L,
325L, 89L, 120L, 318L, 31L, 7L, 311L, 81L, 124L, 310L, 84L, 111L,
320L, 42L, 5L, 324L, 163L, 196L, 307L, 92L, 326L, 70L, 127L,
296L, 93L, 172L, 301L, 74L, 103L, 323L, 17L, 6L, 299L, 167L,
210L, 297L, 85L, 142L, 303L, 55L, 102L, 312L, 8L, 134L, 239L,
341L, 110L, 256L, 37L, 105L, 289L, 14L, 104L, 279L, 331L, 130L,
201L, 46L, 211L, 215L, 39L, 248L, 183L, 49L, 178L, 272L, 56L,
222L, 220L, 11L, 203L, 175L, 50L, 180L, 270L, 44L, 207L, 219L,
27L, 231L, 181L, 174L, 275L, 28L, 205L, 199L, 61L, 202L, 260L,
19L, 147L, 252L, 53L, 193L, 264L, 77L, 274L, 228L, 36L, 151L,
276L, 47L, 190L, 254L, 69L, 227L, 246L, 12L, 138L, 245L, 62L,
198L, 269L, 75L, 251L, 250L, 18L, 152L, 240L, 33L, 195L, 223L,
60L, 208L, 253L, 22L, 154L, 243L, 30L, 192L, 217L, 186L, 263L,
40L, 160L, 267L, 20L, 188L, 206L, 67L, 216L, 10L, 146L, 232L,
72L, 257L, 65L, 249L, 34L, 159L, 259L, 78L, 236L, 268L, 90L,
265L, 261L, 26L, 156L, 255L, 83L, 238L, 57L, 200L, 258L, 35L,
185L, 235L, 86L, 229L, 277L, 71L, 214L, 38L, 155L, 273L, 73L,
262L, 59L, 213L, 242L, 24L, 158L, 241L, 332L, 106L, 226L, 29L,
115L, 281L, 342L, 133L, 234L, 54L, 135L, 288L, 334L, 113L, 224L,
51L, 292L, 333L, 123L, 209L, 148L, 287L, 338L, 230L, 52L, 149L,
285L, 16L, 145L, 247L, 48L, 141L, 284L, 339L, 136L, 225L, 64L,
161L, 286L, 335L, 122L, 218L, 76L, 182L, 290L, 21L, 221L, 41L,
132L, 283L, 337L, 128L, 43L, 282L, 32L, 177L, 244L, 45L, 109L,
291L, 336L, 139L, 212L, 15L, 119L, 271L, 25L, 173L, 233L, 23L,
118L, 278L, 9L, 140L, 237L, 13L, 121L, 266L, 340L, 143L, 114L,
280L, 168L, 157L, 330L, 94L, 131L, 327L, 165L, 171L, 321L, 80L,
126L, 309L, 66L, 107L, 304L, 96L, 191L, 298L, 68L, 108L, 302L,
164L, 179L, 317L, 79L, 125L, 308L, 169L, 189L, 328L, 87L, 129L,
313L, 166L, 153L, 329L, 58L, 112L, 293L, 101L, 176L, 315L, 88L,
144L, 306L, 98L, 194L, 300L, 82L, 116L, 314L, 99L, 184L, 305L,
150L, 322L, 97L, 197L, 295L, 91L, 137L, 319L, 162L, 316L, 63L,
117L, 294L, 95L, 187L), .Label = c("0.028", "0.277", "1.18",
"1.228", "1.80326086956522", "1.82538461538462", "1.87352941176471",
"10.0730769230769", "10.2839116719243", "10.2857142857143", "10.3172978505629",
"10.4545454545455", "10.5833333333333", "10.6786516853933", "10.743670886076",
"10.7611940298507", "10.7630769230769", "10.8724832214765", "10.8888888888889",
"10.9649122807018", "10.9861591695502", "11.0655737704918", "11.3061002178649",
"11.319587628866", "11.4805194805195", "11.4963503649635", "11.5434782608696",
"11.6022099447514", "11.6552356020942", "11.6666666666667", "11.8470588235294",
"11.90036900369", "11.9148936170213", "11.9601328903654", "12",
"12.0670391061453", "12.1090909090909", "12.2093023255814", "12.3068893528184",
"12.3287671232877", "12.413436123348", "12.4434782608696", "12.5626326963907",
"12.664907651715", "12.789817232376", "12.8070175438596", "12.8735632183908",
"12.9442567567568", "12.9661016949153", "13.0057803468208", "13.0934984520124",
"13.2892966360856", "13.3333333333333", "13.3995348837209", "13.4366197183099",
"13.4615384615385", "13.7055837563452", "13.8461538461538", "13.8709677419355",
"13.9285714285714", "13.9490445859873", "14.1333333333333", "14.3333333333333",
"14.5278538812785", "14.5398773006135", "14.58", "14.6092184368737",
"14.6428571428571", "14.7368421052632", "14.8109589041096", "15.1048951048951",
"15.2719665271967", "15.3846153846154", "15.6489795918367", "15.8029978586724",
"15.8326446280992", "16.0336134453782", "16.1094224924012", "16.1407491486947",
"16.258064516129", "16.2920547945206", "16.3157894736842", "16.4265129682997",
"16.530612244898", "16.56", "16.6204986149585", "16.7095588235294",
"16.8352941176471", "16.9363636363636", "16.9465648854962", "17.7372262773723",
"17.82", "18.0495652173913", "18.7354085603113", "18.7873831775701",
"18.9743276283619", "19.070821529745", "19.2223463687151", "19.3025059665871",
"19.46", "19.8472392638037", "2.1", "2.25857142857143", "2.35112359550562",
"2.35318181818182", "2.36631016042781", "2.3808", "2.39880952380952",
"2.45383812010444", "2.45785714285714", "2.46734693877551", "2.46807692307692",
"2.49122807017544", "2.49721627408994", "2.50130890052356", "2.50175438596491",
"2.50583333333333", "2.51938997821351", "2.52236286919831", "2.53636363636364",
"2.5426116838488", "2.54666666666667", "2.55700325732899", "2.5641095890411",
"2.56515323496027", "2.57", "2.57465753424658", "2.57911392405063",
"2.58143382352941", "2.58333333333333", "2.58735408560311", "2.59030837004405",
"2.6", "2.61115384615385", "2.62093023255814", "2.64516129032258",
"2.64744525547445", "2.65378787878788", "2.66086956521739", "2.66561514195584",
"2.68506756756757", "2.70733333333333", "2.71074380165289", "2.71341176470588",
"2.71641791044776", "2.72357142857143", "2.73259259259259", "2.75022222222222",
"2.75418960244648", "2.75885167464115", "2.77960893854749", "2.80872483221477",
"2.81130099228225", "2.82049180327869", "2.84767441860465", "2.85109489051095",
"2.8855376344086", "2.91463917525773", "2.93521594684385", "2.96198630136986",
"2.99369863013699", "20.146408839779", "20.196", "20.2125", "20.5180555555556",
"20.6174200661522", "20.91", "22.1182795698925", "23.2993527508091",
"24.14", "3.00648148148148", "3.01032608695652", "3.01298701298701",
"3.01412742382271", "3.01777777777778", "3.02319018404908", "3.02583025830258",
"3.04745762711864", "3.04757352941176", "3.06416184971098", "3.0686327077748",
"3.0695867768595", "3.10684596577017", "3.11115751789976", "3.14428571428571",
"3.15802139037433", "3.16845794392523", "3.17982456140351", "3.18333333333333",
"3.19540229885058", "3.19889975550122", "3.20833333333333", "3.22222222222222",
"3.22245810055866", "3.23404255319149", "3.247", "3.32762039660057",
"3.33333333333333", "3.36538461538462", "3.3753807106599", "3.38618181818182",
"3.41592356687898", "3.42681678607984", "3.44378787878788", "3.4475138121547",
"3.44827586206897", "3.46965699208443", "3.47642857142857", "3.53503184713376",
"3.53784090909091", "3.54385964912281", "3.54901960784314", "3.56666666666667",
"3.57692307692308", "3.61386138613861", "3.63426853707415", "3.63636363636364",
"3.63874345549738", "3.65019011406844", "3.66666666666667", "3.67052023121387",
"3.67132867132867", "3.68421052631579", "3.69014084507042", "3.70121951219512",
"3.72881355932203", "3.73450292397661", "3.73890909090909", "3.73961218836565",
"3.76966292134831", "3.77054347826087", "3.78536585365854", "3.81034482758621",
"3.82051282051282", "3.82535211267606", "3.82978723404255", "3.85798816568047",
"3.86167146974063", "3.86671232876712", "3.88", "3.89276315789474",
"3.8981308411215", "3.93243243243243", "3.93292682926829", "3.94867256637168",
"3.95533980582524", "3.96153846153846", "3.97045929018789", "3.97046632124352",
"3.977", "3.98286937901499", "3.99411764705882", "4.01592356687898",
"4.02877697841727", "4.04166666666667", "4.04478764478765", "4.05555555555556",
"4.06993006993007", "4.08421052631579", "4.09306358381503", "4.10171428571429",
"4.11642411642412", "4.1244094488189", "4.13793103448276", "4.1412213740458",
"4.16324503311258", "4.17204301075269", "4.20634920634921", "4.24",
"4.25438596491228", "4.26024590163934", "4.26465517241379", "4.29746835443038",
"4.29831932773109", "4.31111111111111", "4.35140186915888", "4.44444444444444",
"4.4885593220339", "4.55253333333333", "4.60058823529412", "4.66061538461538",
"4.68139534883721", "4.79325", "4.82182490752158", "4.82611534276387",
"4.85381165919282", "4.87160633484163", "5.1135652173913", "5.15784431137725",
"5.1589709762533", "5.21324296141814", "5.26390243902439", "5.6231884057971",
"5.73333333333333", "5.73658536585366", "5.8122905027933", "5.9160736196319",
"5.93722627737226", "5.95752212389381", "5.97086092715232", "6.00165517241379",
"6.11846153846154", "6.13099236641221", "6.13828125", "6.21025641025641",
"6.21895161290323", "6.22588235294118", "6.30699588477366", "6.34085603112841",
"6.36", "6.38901098901099", "6.46478873239437", "6.48807947019868",
"6.53695652173913", "6.57131782945736", "6.61245674740484", "6.63870967741935",
"6.693", "6.71538461538461", "6.71538461538462", "6.83117647058824",
"6.88387096774194", "6.94487394957983", "6.97215189873418", "7.01647058823529",
"7.04807339449541", "7.25804195804196", "7.32621359223301", "7.34082397003745",
"7.67259786476868", "8.72727272727273", "8.82352941176471", "9.03908794788274",
"9.19298245614035", "9.26666666666667", "9.44347826086956", "9.4620253164557",
"9.64080459770115", "9.79032258064516", "9.86776859504132", "9.91836734693878",
"9.93333333333333", "annual", "N-FIXER", "NO-N-fixer", "perennial"
), class = "factor")), row.names = c(1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L,
33L, 34L, 35L, 36L, 37L, 38L, 39L, 41L, 43L, 45L, 50L, 52L, 58L,
59L, 60L, 67L, 68L, 69L, 76L, 77L, 78L, 85L, 86L, 87L, 94L, 95L,
96L, 103L, 104L, 105L, 112L, 113L, 114L, 121L, 123L, 130L, 131L,
132L, 139L, 140L, 141L, 148L, 149L, 150L, 157L, 158L, 159L, 166L,
167L, 168L, 175L, 176L, 177L, 184L, 185L, 186L, 193L, 194L, 195L,
202L, 203L, 204L, 211L, 212L, 213L, 220L, 221L, 222L, 229L, 230L,
231L, 237L, 238L, 239L, 245L, 246L, 247L, 253L, 254L, 255L, 261L,
262L, 263L, 269L, 270L, 271L, 277L, 278L, 279L, 285L, 286L, 287L,
293L, 294L, 295L, 302L, 303L, 309L, 310L, 311L, 317L, 318L, 319L,
325L, 326L, 327L, 333L, 334L, 335L, 341L, 342L, 343L, 349L, 350L,
351L, 357L, 358L, 359L, 365L, 366L, 367L, 373L, 374L, 375L, 381L,
382L, 383L, 389L, 390L, 391L, 397L, 398L, 399L, 405L, 406L, 407L,
413L, 414L, 415L, 421L, 422L, 423L, 429L, 430L, 431L, 438L, 439L,
445L, 446L, 447L, 453L, 454L, 455L, 461L, 462L, 469L, 470L, 471L,
477L, 479L, 485L, 487L, 493L, 494L, 495L, 501L, 502L, 503L, 509L,
510L, 511L, 517L, 518L, 519L, 525L, 526L, 533L, 534L, 535L, 541L,
542L, 543L, 549L, 550L, 551L, 557L, 558L, 565L, 566L, 567L, 573L,
574L, 581L, 582L, 583L, 589L, 590L, 591L, 597L, 598L, 599L, 603L,
604L, 605L, 611L, 612L, 613L, 617L, 618L, 619L, 625L, 626L, 627L,
631L, 633L, 639L, 640L, 641L, 646L, 647L, 653L, 655L, 659L, 660L,
661L, 667L, 668L, 669L, 673L, 674L, 675L, 681L, 682L, 683L, 687L,
688L, 689L, 695L, 696L, 697L, 701L, 702L, 703L, 709L, 711L, 715L,
716L, 717L, 723L, 724L, 729L, 731L, 737L, 738L, 739L, 743L, 744L,
745L, 751L, 752L, 753L, 757L, 758L, 759L, 765L, 766L, 767L, 771L,
772L, 773L, 779L, 780L, 781L, 785L, 786L, 787L, 793L, 794L, 800L,
801L, 807L, 808L, 809L, 815L, 816L, 817L, 823L, 824L, 825L, 831L,
832L, 833L, 847L, 848L, 849L, 855L, 856L, 857L, 863L, 864L, 865L,
871L, 872L, 873L, 879L, 880L, 881L, 887L, 888L, 889L, 895L, 896L,
897L, 903L, 904L, 905L, 911L, 912L, 913L, 919L, 920L, 921L, 927L,
928L, 929L, 935L, 936L, 937L, 943L, 944L, 945L, 951L, 952L, 953L,
960L, 961L, 967L, 968L, 969L, 975L, 976L, 977L, 983L, 985L, 991L,
992L, 993L, 999L, 1000L), class = "data.frame")
And here is the head of my data:
head(Df_TR)
AccSpeciesName TraitName OrigValueStr
1 Achillea millefolium Plant lifespan (longevity) perennial
2 Achillea millefolium Plant nitrogen(N) fixation capacity NO-N-fixer
3 Angelica sylvestris Plant lifespan (longevity) perennial
4 Angelica sylvestris Plant nitrogen(N) fixation capacity NO-N-fixer
5 Anthriscus sylvestris Plant lifespan (longevity) perennial
6 Anthriscus sylvestris Plant nitrogen(N) fixation capacity NO-N-fixer
Any help would be much appreciated!