user3046636 user3046636 - 4 years ago 114
R Question

How count elements in an column that are not empty

I just started with R, and i have to count elements from an column that are not empty.
For example :

exampleColumn
1 "heey"
2
3 "World"
4 "how are you "


How can I achieve this ?

Answer Source

If you want to count the strings that are not identical to the empty string (""), you can use:

sum(dat$exampleColumn != "")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download