Extracting columns having greater than certain values in R dataframe

前端 未结 5 1647
滥情空心
滥情空心 2021-01-26 22:14

I have a dataframe:

Alix    Blim    Jux Gyno
0.105   0.234   0.67    0.89
0.01    0.542   0.11    0.65
0.003   0.002   0.6     0.67
0.009   0.123   0.09    0.01
         


        
5条回答
  •  一向
    一向 (楼主)
    2021-01-26 23:02

    Please provide a reproducible example for future questions.

    Here is my dplyr solution:

    library(tidyverse)
    
    df <- tibble(First = 0:5,
                 Second = 10:15,
                 Third = 20:25)
    
    is_greater_than <- function(x) any(x > 10)
    
    select_if(df, is_greater_than)
    

提交回复
热议问题