Return row of Data Frame based on value in a column - R

后端 未结 4 990
無奈伤痛
無奈伤痛 2021-01-31 09:43

My R data.frame df looks like:

     Name     Amount
1    \"A\"      150
2    \"B\"      120
3    \"C\"      \"NA\"
4    \"D\"      160
.
.
.
         


        
4条回答
  •  时光说笑
    2021-01-31 10:18

    Based on the syntax provided

     Select * Where Amount = min(Amount)
    

    You could do using:

     library(sqldf)
    

    Using @Kara Woo's example df

      sqldf("select * from df where Amount in (select min(Amount) from df)")
      #Name Amount
     #1    B    120
     #2    E    120
    

提交回复
热议问题