Take iris as the data frame, I want to extract all rows and column variables (Petal.Length,Petal.Width,Sepal.Length,Sepal.Width) that have species as a specific value. eg setosa. it should show 50 entries. I tried aggregate but didnt work. It is the equivalent and of the WHERE clause in SQL.
You are looking for the subset command.
data(iris)
dat<-subset(iris,subset=Species=='setosa')
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.