PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, August 15, 2022

[FIXED] How to suppress RED progress messages that are not warning messages? SOLUTIONS NOT WORKING

 August 15, 2022     output, r, suppress, suppressmessage     No comments   

Issue

I have a script and in that script I am running a command form a package: proteinToGenome() from the ensembldb package.

I run the command iteratively using a for () {} structure, and upon each iteration it will return RED output that is more of "progress" messages that output regardless of the success/failure of the command, not warning messages:

Checking CDS and protein sequence lengths ... 1/1 OK

Fetching CDS for 1 proteins ... 1 found

or:

Fetching CDS for 1 proteins ... 1 found

Checking CDS and protein sequence lengths ... 0/0 OK

How do I suppress these messages? Other questions I found do not seem to apply to these and their solutions do not seem to stop these. I have tried all the solutions presented in:

Suppress output of a function

I have tired:

capture.output(for (x in length(DF)) { 
        OutputDF <- function(DF[x])
})

and:

sink(for (x in length(DF)) { 
        OutputDF <- function(DF[x])
})

also tried:

hush=function(code){
  sink("NUL") # use /dev/null in UNIX
  tmp = code
  sink()
  return(tmp)
}
hush(for (x in length(DF)) { 
        OutputDF <- function(DF[x])
})

also, the reason I use for and not lapply() is because I check whether or not the OutputDF is empty, and take action accordingly using an if(){}else{} command within the for(){} loop


Solution

How about:

suppressMessages(proteinToGenome(...))

Where the arguments you are using in the model replace ...



Answered By - DaveArmstrong
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing