Quantcast
Viewing all articles
Browse latest Browse all 4448

How to select top 10 records while using the aggregate function in R

@hackers wrote:

Hello,

I am using the following code:

agg_sales_pcat <- aggregate(store_sales ~ product_category,data = agg_sales,mean)
to aggregate store sales product category wise.But there are 45 different product categories and I want only the top 10 records from agg_sales_pcat.
So is there a way to do this in aggregate or do i have to use separate line of code for this??

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles