July 21st, 2013, 11:16 PM
Join Date: Jun 2013
Time spent in forums: 1 h 13 m 17 sec
Reputation Power: 0
How to calculate the sets of a set, ordered set, generic set?
How to represent the sets of a set, ordered set, generic set? Many operations on sets are hard to implement through SQL. Moreover, the computation is not limited on database, such as the data from Excel and even there is no database in the application environment. In this case, how do you deal with it?
Letís check it out with this example: a sales department needs to make statistics on the outstanding salesmen who account for half of the total sales based on their sales records.
With esProc, it can dealt with as follows,
With R, it can be dealt with like:
04 originalData<-sqlQuery(conn,'select * from salesOrder')
06 nameSum<-aggregate(originalData$sales,list(originalData$nam e),sum)
11 subset(orderData,addup<=halfSum | (addup>halfSum & c( 0, addup[- length (addup)]) <halfSum))
Do you have any other ways?