This is my first question in this forum and I have limited experience with R, so my apologies if the question is unclear in some way or if it is too basic.
I have a dataframe called values that consists of a sample number column, two factor variables (H and W), and several number columns (named as number intervals after a cut), as follows:
sample H W (12.95,13] (13,13.05] (13.05,13.1] (13.1,13.15]
130 bg d 0 0 0 0
131 bg d 0 0 0 0
132 bg d 0 0 0 0
133 x i 0 0 0 0
134 x i 0 0 0 0
135 x i 0 0 0 0
136 x i 0 0 0 0
137 x i 0 0 0 0
138 x i 0 0 0 0
139 x i 0 0 0 0
140 x i 0 0 0 0
141 x i 0 35947.65 0 0
142 x i 0 0 0 0
143 x i 0 0 0 0
144 x i 0 0 0 0
145 x i 0 0 0 73709.67
146 x i 0 0 0 0
147 x i 21756.63 0 32362.41 0
148 x i 0 0 0 0
149 x i 0 0 0 0
150 x i 0 0 0 0
151 x i 0 0 0 0
152 x c 0 0 0 0
153 x c 0 0 0 0
154 x c 0 0 0 0
155 x c 0 0 0 32578.03
I need to count how many rows in each of the number columns for each treatment combination and sample number have values greater than 0. I have tried the aggregate, count and sum functions but have had no success so far.
Could someone help me out with this?
Thank you!