从R中的列中删除双精度值

问题描述 投票:0回答:1

enter image description here

我需要知道每个公司(ID)生产多少种不同的物品。结果应该是这样的:

  • 公司1 = 4(A,B,C,D)
  • 公司2 = 1(B)
  • 公司3 = 2(A,B)
  • 公司4 = 2(A,B)

我应该使用哪个代码到达那里?我想应该是可以让我计算每个ID的唯一值的东西。

谢谢

r dataframe count unique rows
1个回答
0
投票

我认为您可以使用split() +unique()+ nrow()来制作它,即

© www.soinside.com 2019 - 2024. All rights reserved.