[R] Finding the rows with the duplicated index
ggrothendieck at gmail.com
Tue Nov 23 18:04:11 CET 2010
On Tue, Nov 23, 2010 at 11:49 AM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> Thanks. Sorry about the naming (just cobbled the example).
> The rows are duplicate in the actual data. I am looking for a way to find
> the number of duplicate rows for each unique rowindex combination which is
> based on columns 1:6.
Ag <- aggregate(TrdPrice ~., DF2[1:7], length)
names(Ag) <- "length"
where DF2 was defined previously.
Note that when you read in the data into zoo you can aggregate it at
the same time using the aggregate argument to read.zoo. For
example, note the aggregate argument in the following:
z <- read.zoo(DF2[c(1:2, 4, 6:8)], split = 2, tz = "", aggregate =
function(x) tail(x, 1))
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
email: ggrothendieck at gmail.com
More information about the R-help