I have a data.frame (DF) that looks like this:
Col_names1 Col_values1 Col_names2 Col_values2 a 98 f 1 b 12 h 0.8 d 0 mn 0 e 0.12 p 0 .... .... .... ....
I have to table the frequencies of Col_names in each Col_names column row by row. To do so firstly I extracted only the names to have the following new_DF
Col_names1 Col_names2 a f b h d mn e p .... ....
Then I used the apply function to table the frequencies of the names row by row:
apl = apply(new_DF, 1, table)
The problem is that it gives to me the frequencies of names even when (as for "d" for example) the associated numerical value in the initial DF is "0". This frequencies have not to be computed.
PS: Totally the data.frame has 500 columns and 80 rows.