The data.table package in R provides the ability to:
which: 'TRUE returns the number of integer strings' x that' i matches.
However, I see no way to get within the jintegers of the 'x' strings within the groups set with by.
For example, this ...
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6))
... I would like to know the indices in DT for each y value.
The meaning for me is that I use the data.table in parallel with another data structure (ADS), to which I intend to perform group calculations based on effectively calculated data table groupings.
For example, if ADS is a vector with a value for each row in the DT:
ADS<-sample(100,nrow(DT))
ADS, DT $y , .
DT[,seqNum:=seq_len(nrow(DT))]
DT[,mean(ADS[seqNum]),by=y]
, .
, , tapply:
tapply(ADS,DT$y,mean)
, data.tables( "by" ).
, - , ???
, data.table, (, )???
: '.which' , :
DT[,mean(ADS[.which]),by=y,which=TRUE]