R: Remove multiple empty columns of character variables

后端 未结 9 1240
轮回少年
轮回少年 2020-12-08 11:06

I have a data frame where all the variables are of character type. Many of the columns are completely empty, i.e. only the variable headers are there, but no values. Is ther

9条回答
  •  猫巷女王i
    2020-12-08 11:42

    This can also be done by dplyr and select_if

    `select_if(df,function(x){any(!is.na(x))})`
    

    or with is.null() or x=="" depending on how empty values are defined in your data.

提交回复
热议问题