get Row Number for R data frame

前端 未结 2 640
误落风尘
误落风尘 2021-02-04 22:34

A question about data frames in R. I want to extract a row from a data frame, along with its position(row number) in the original data frame. The idea is to create a new data f

2条回答
  •  我寻月下人不归
    2021-02-04 23:00

    You can do this in one or two lines of code:

    rNo <- as.integer(rownames(patchList[which(patchListTop5$sensitivity == patchLocalSpec),]))
    patchLocalNo <- cbind(patchLocalNo[rNames,], rNo)
    

提交回复
热议问题