我有默认命名的图例(Species)。有没有办法删除" wt" - 在图例中的文字末尾,自动?谢谢!
这是代码
a = '2.45'
Decimal(a) # => 2.45
在这里你可以看到data
答案 0 :(得分:2)
正如ZéLoff指出的那样,你可以替换变量
weedweights <- data%>%
select(-ends_with("No"))%>%
gather(key=species, value=speciesmass, DIGSAWt:UnknownmonocotWt)%>%
mutate(realmass= (10*speciesmass) / samplearea.m.2.)%>%
group_by(Rot.Herb, species)%>%
summarize(avgrealmass=mean(realmass, na.rm=TRUE))%>%
filter(avgrealmass != "NaN")%>%
ungroup() %>% mutate(species = gsub("Wt$", "", species))