I have been studying a datacamp course called "Data Analysis in R, the data.table Way".
练习的指导如下,
布局如下,
# This is your data.table `DT`. The keys are set to `A` and `B`
DT <- data.table(A=letters[c(2,1,2,3,1,2,3)], B=c(5,4,1,9,8,8,6), C=6:12)
setkey(DT,A,B)
# Select the `b` group
# `b` and `c` groups
# The first row of the `b` and `c` group
# `by=.EACHI` and `.SD`
# Print out all the data in the two groups before you return …Run Code Online (Sandbox Code Playgroud)