Questions tagged «sqldf»

7
按组选择第一行
从这样的数据框中 test <- data.frame('id'= rep(1:5,2), 'string'= LETTERS[1:10]) test <- test[order(test$id), ] rownames(test) <- 1:10 > test id string 1 1 A 2 1 F 3 2 B 4 2 G 5 3 C 6 3 H 7 4 D 8 4 I 9 5 E 10 5 J 我想用每个ID /字符串对的第一行创建一个新的。如果sqldf接受其中的R代码,则查询可能如下所示: …
85 r  dataframe  sqldf 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.