fast subsetting in R

后端 未结 5 487
情书的邮戳
情书的邮戳 2021-02-03 14:00

I\'ve got a dataframe dat of size 30000 x 50. I also have a separate list that contains points to groupings of rows from this dataframe, e.g.,

rows <- list(c(         


        
5条回答
  •  孤街浪徒
    2021-02-03 14:41

    You could try this modification:

    system.time(lapply(rows, function(r) {dat[ rownames(dat) %in% r, ]}))
    

提交回复
热议问题