multi-word argument

Issue #10 invalid
Former user created an issue

Arguments such as --plot-style aren't properly set anymore. I used to be able to test

if (argv$plot-style) == "bar")

but now argv$plot-style or any combination of word separated by '-' returns NULL now

Comments (5)

  1. David Shih repo owner

    An incompatibility was introduced in v0.4 where - are replaced with _ in argument names. (This is documented in the README.)

    I must say that I am surprised that argv$plot-style used to work... this should have been a parse error in R.

    Now, you'll instead need to write:

    argv$plot_style
    

    The only character substitution that argparser does is to convert - to _.

  2. David Shih repo owner

    I just checked... there is no way that argv$plot-style used to work. It indeed generates a parse error, because it is interpreted as argv$plot - style by R. If style is defined, this would generate a silent bug.

    Your old code is very likely bugged, unless you actually wrote argv[["plot-style"]].

    Again, use _ instead of - in your variable names: argv$plot_style.

  3. Benjamin Lorendeau

    Yeah sorry my bad :)

    I saw the status of the v0.4 just after...

    I had no account so i couldn't edit my message and didn't want to create one... The misunderstanding comes from my use of " ` " before and after plot-style. It was interpreted as markdown styling by bitbucket but was actually raw R text...

  4. David Shih repo owner

    Sorry about the compatibility break. I was hesitant about the automatic substitution (requested by another user)... but in the end I decided that it is better to do it now rather than later.

  5. Log in to comment