我想通过一个变量对我的数据框进行分组,汇总另一个变量,但保留所有其他相关列。),如果答案已经存在于数据中(即min,max),则可以很好地工作,但如果您想要使用生成新答案(即sum,mean)的函数,则此方法不起作用。在Applying group_by and summarise(sum) but keep columns with non-relevant conflicting data?中,公认的答案是使用您希望保留的所有列作为分组变量的一部分
我的问题与非常相似,但我希望保留那些因为分组后冲突而被排除在外的列。the Label and Code are the same the Proportion, N and C group_byup to 1 summarise_if(is.numeric, sumwholefish_formula
6