dense-rank

How to emulate SQL “partition by” in R?

心已入冬 提交于 2019-11-28 03:52:03
How can I do analytic functions like the Oracle ROW_NUMBER(), RANK(), or DENSE_RANK() functions (see http://www.orafaq.com/node/55 ) on a R data frame? The CRAN package "plyr" is very close but is still different. I agree that the functionality of each function can potentially be achieved in an ad-hoc fashion. But my main concern is the performance. It would be good to avoid using join or indexing access, for the sake of memory and speed. BenBarnes The data.table package, especially starting with version 1.8.1, offers much of the functionality of partition in SQL terms. rank(x, ties.method =

How to emulate SQL “partition by” in R?

家住魔仙堡 提交于 2019-11-27 05:13:55
问题 How can I do analytic functions like the Oracle ROW_NUMBER(), RANK(), or DENSE_RANK() functions (see http://www.orafaq.com/node/55) on a R data frame? The CRAN package "plyr" is very close but is still different. I agree that the functionality of each function can potentially be achieved in an ad-hoc fashion. But my main concern is the performance. It would be good to avoid using join or indexing access, for the sake of memory and speed. 回答1: The data.table package, especially starting with