2017-03-03 75 views

回答

0

我会建议使用您的数据子集dplyr

# install.packages("dplyr") 
library(dplyr) 

以下将给出所有UNITPRICE总和QUANTITY> 40

plotData <- daots2 %>% 
        filter(UNITPRICE > 40) %>% 
        summarise(quantSum = sum(QUANTITY)) 

下面将为您公司为其UNITPRICE> 40数量的计数

plotData <- daots2 %>% 
        filter(UNITPRICE > 40) %>% 
        summarise(uniqueCompany = n_distinct(ProductName)) 
+0

我把我的数据的形象。谢谢。我想获得这些公司拥有UNITPRICE> 40 –

+0

天使的数量,我编辑了我的答案以反映这种需求。 –