Dear evolozzy, Thank you so much for your great guide. I am running your codes, but got Error when running:
newColumn<-as.data.frame(Ratio=output.df$Found_experiments/sum(output.df$Found_experiments))
Error in as.data.frame(Ratio = output.df$Found_experiments/sum(output.df$Found_experiments)) :
argument "x" is missing, with no default
Also, the numbers for "Found_experiments" column looks strange (all of them are in the below range):
> output.df$Found_experiments
[1] 330 337 335 342 342 340 341 315 331 342 338 342 331 342 341 342 342 340 341 341 340 342 342 340 339 341 339 339 342 340 341 341 342 337 342 325 315 300 338 340 [41] 340 337 342 342 342 328 335 323 342 342 338 339 329 298 320 342 342 340 334 338 325 316 308 332 330 340 342 342 342 304 340 331 340 335 340 327 341 341 340 342 [81] 330 342 342 341 340 342 342 341 330 333 342 342 314 335 290 301 340 328 315 318 325 331 342 342 342 342 342 342 342 342 342 341 342 342 340 340 342 341 342 342
While many of them should be 2, 5, 10, ....
Moreover, running >sum(output.df$Found_experiments) gave me [1] 2896905, while it should be 412 (if there was not any columns with all zero cells). As in section 4, I asked for “number of columns found with non zero count” from column 6 to 417 divided to number of columns from 6 to 417. By this, I mean, for each row, summing the number of cells which are non zero, not their contents. I need something like:
cc1 cc2 cc3 cc4 Found_experiments Ratio
gene1 a 3 0 6 0 2 2 ÷ 4
gene2 b 0 0 0 23 1 1 ÷ 4
gene3 c 32 8 15 0 3 3 ÷ 4
gene4 d 7 12 32 54 4 4 ÷ 4
gene5 e 9 0 0 0 1 1 ÷ 4
Many thanks for your help.

it's hard to understand without seeing a snapshot of your data.
Thanks for your comment. I have attached a snapshot of my data at the end of my post. However, it contains row number 8900 and cc columns up to cc412.
What have you tried?
if you are learning R, consider doing some tutorials first
if you need this for your work/task/thesis, why not using Excel directly?
Thanks for your suggestion. I was wondering if I can have something as below using Excel directly.
Thank you.
check the COUNTIF function
Great. Thanks a lot.