I have a big dataset that contains a lot of NA
s and some non-Na values.
At the moment I count my non-NA
values for each column like this:
attach(df)
1000 - (sum(is.na(X1)))
1000 - (sum(is.na(X2)))
1000 - (sum(is.na(X3)))
1000 - (sum(is.na(X4)))
1000 - (sum(is.na(X5)))
...
detach(df)
So my overall length of my observations - the sum of my NA
values.
Is there a faster way which uses less code lines and typing effort and gives me fast overview of all the columns and numbers of non-NA
values?
Like a for loop or something?
I am looking for something like this:
X1 Amount of Non-Na-Values
X2 ...
X3 ...
X4
X5
X6
Thank you :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…