简体   繁体   中英

find rows where the variable “back” is greater than 100

The question is write the code to provide the rows where the variable “back” is greater than 100.I am a new for the R,now I only use x<-read.csv('data.csv',header = TRUE) to load the excel, just want to know how to find rows which value more than 100

Create a logical vector with the comparison operator ( > ), get the positions by wrapping with which and if we need to include the column names as index 1, then concatenate 1 and add 1 to the index we got with which

c(1, which(x$back > 100) + 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM