How to suppress the warming message by R when using commandArgs()

xie186

Here is my code:

Args <- commandArgs();
for(i in 1:length(Args)){
    if(Args[i] == "--input")      input  = Args[i+1]
    if(Args[i] == "--output")     fig = Args[i+1]
    if (Args[i] == "--height")    fig_height = as.numeric(Args[i+1])
    if (Args[i] == "--width")     fig_width  = as.numeric(Args[i+1])
}
cat(input, fig, fig_height, fig_width, "\n")

I put it in a text file. If I run this code on the terminal:

R --vanilla --slave --input xx --height 10 --width 14 --output out < test.R

I'll get the warning message shown as below:

WARNING: unknown option '--input'

ARGUMENT 'xx' ignored

WARNING: unknown option '--height'

ARGUMENT '10' ignored

WARNING: unknown option '--width'

ARGUMENT '14' ignored

WARNING: unknown option '--output'

ARGUMENT 'out' ignored

xx out 10 14

How can I get rid of the `WARNING` and 'ARGUMENT 'xx' __ignored__'?

Thanks.

xie186

I found a way to avoid warning message: Instead of using:

R --vanilla --slave --input xx --height 10 --width 14 --output out < test.R

I use:

Rscript test.R --input xx --height 10 --width 14 --output out 

Then there is no warning message and here is the output:

xx out 10 14

Hope this can help others.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to suppress OpenCV error message

From Dev

How to suppress [no test files] message on go test

From Dev

Suppress error message in R

From Dev

How to suppress R startup message?

From Dev

How to suppress zeroes when using geom_histogram with scale_y_log10

From Dev

How to suppress awk output when using FS?

From Dev

R testthat package: How can I see output from message() when using test_file()

From Dev

Suppress convergence message in nnet multinom function in R

From Dev

Suppress tempdb message when outputting result set

From Dev

How to suppress warnings in maven output when using maven-checkstyle-plugin?

From Dev

How do I suppress row names when using DT::renderDataTable in R shiny?

From Dev

How to suppress the error message when dividing 0 by 0 using np.divide (alongside other floats)?

From Dev

How to suppress error message of a command?

From Dev

PostgreSQL - How to suppress query statement message

From Dev

Unable to suppress clipboard warning message when closing a file

From Dev

How to suppress download.file() "trying URL..." message in R?

From Dev

Suppress bold when using "__"

From Dev

How to suppress text using JQuery?

From Dev

How can I suppress command output when using backticks?

From Dev

Suppress error message in R

From Dev

Suppress 'file truncated' messages when using tail

From Dev

Suppress Message Box R6025 Pure Virtual Function Call

From Dev

Not able to suppress the error message using /dev/null

From Dev

How to suppress Debian uname message when ssh'ing into the machine? Plus changing it to something else, if possible

From Dev

How to suppress certain error message in 'find' command?

From Dev

How to suppress infinite loop note when using "IF 0 THEN SET"

From Dev

How to suppress warning message in R regarding closing unused connection?

From Dev

How to suppress File in use alert message

From Dev

Outlook web Addin: how to suppress the default notification message comes up when clicking on the button

Related Related

  1. 1

    How to suppress OpenCV error message

  2. 2

    How to suppress [no test files] message on go test

  3. 3

    Suppress error message in R

  4. 4

    How to suppress R startup message?

  5. 5

    How to suppress zeroes when using geom_histogram with scale_y_log10

  6. 6

    How to suppress awk output when using FS?

  7. 7

    R testthat package: How can I see output from message() when using test_file()

  8. 8

    Suppress convergence message in nnet multinom function in R

  9. 9

    Suppress tempdb message when outputting result set

  10. 10

    How to suppress warnings in maven output when using maven-checkstyle-plugin?

  11. 11

    How do I suppress row names when using DT::renderDataTable in R shiny?

  12. 12

    How to suppress the error message when dividing 0 by 0 using np.divide (alongside other floats)?

  13. 13

    How to suppress error message of a command?

  14. 14

    PostgreSQL - How to suppress query statement message

  15. 15

    Unable to suppress clipboard warning message when closing a file

  16. 16

    How to suppress download.file() "trying URL..." message in R?

  17. 17

    Suppress bold when using "__"

  18. 18

    How to suppress text using JQuery?

  19. 19

    How can I suppress command output when using backticks?

  20. 20

    Suppress error message in R

  21. 21

    Suppress 'file truncated' messages when using tail

  22. 22

    Suppress Message Box R6025 Pure Virtual Function Call

  23. 23

    Not able to suppress the error message using /dev/null

  24. 24

    How to suppress Debian uname message when ssh'ing into the machine? Plus changing it to something else, if possible

  25. 25

    How to suppress certain error message in 'find' command?

  26. 26

    How to suppress infinite loop note when using "IF 0 THEN SET"

  27. 27

    How to suppress warning message in R regarding closing unused connection?

  28. 28

    How to suppress File in use alert message

  29. 29

    Outlook web Addin: how to suppress the default notification message comes up when clicking on the button

HotTag

Archive