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
It depends what you mean by empty: Is it NA or "", or can it even be " "? Something like this might work:
""
" "
df[,!apply(df, 2, function(x) all(gsub(" ", "", x)=="", na.rm=TRUE))]