slfan2013 / Shiny-SERRF

10 stars 3 forks source link

Usage of any function in R.app line 720 #2

Closed ShawnWx2019 closed 2 years ago

ShawnWx2019 commented 2 years ago

Hi Dr. Fan,

Thanks for developing SERRF algorithm, It helps me effectively eliminate systematic errors in my untargeted metabolomics project. I am very interested in SERRF algorithm, so I have studied your code carefully. But the usage of any function make me confused in app.R line 720

      if(any(table(p_qc$batch))<7){
        ratio = 0.7
      }else{
        ratio = 0.8
      }

any(table(p_qc$batch) always returns TRUE, I guess you may have accidentally written <7 outside the brackets.

      if(any(table(p_qc$batch)<7)){
        ratio = 0.7
      }else{
        ratio = 0.8
      }

If we move it into brackets, I think this code means that if the number of QC samples in any of the batches is less than <7, ratio will select 0.7, otherwise select 0.8.

I'm still a rookie for R programming, and I'm not sure whether I understand your code correctly.

Looking forward for your reply.

Shawn

slfan2013 commented 2 years ago

Yes. Your understanding is correct.

You can try bracket the code, and the algorithm may still work. However, be careful with overfitting.

ShawnWx2019 commented 2 years ago

Thanks for your reply, I tried the changed code, and the result was also in line with expectations.