从数据帧中删除所有值为NA的列

问题描述:

我无法自己解决这个问题:

数据框具有任意的属性作为列每行表示一个数据集


问题是:

如何摆脱列对于 ALL 行,值为NA

I'm having trouble with a data frame and couldn't really resolve that issue myself:
The dataframe has arbitrary properties as columns and each row represents one data set.

The question is:
How to get rid of columns where for ALL rows the value is NA?

尝试:

df <- df[,colSums(is.na(df))<nrow(df)]