Skip to content

[R-pkg-devel] Help with a note

4 messages · Anirban, Gábor Csárdi, Max Turgeon

#
Hi, I've one note in my package which I can't seem to resolve while
submitting to CRAN:

  New submission

Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
Check: R code for possible problems, Result: NOTE
  Possibly missing '()' after 'return' in the following functions:
    'asymptoticMemoryUsage' 'asymptoticTimings'


There are opening and closing brackets with the return statement to the
functions already. The source code can be found here:
asymptoticTimings:
https://github.com/Anirban166/testComplexity/blob/master/R/asymptoticTimings.R
asymptoticMemoryUsage:
https://github.com/Anirban166/testComplexity/blob/master/R/asymptoticMemoryUsage.R


The note seems trivial but I can't seem to get rid of it. Any help would be
appreciated.

Thanks,
Anirban
#
`return()` is a function in R, so `return` does nothing. You probably
want `return()`.

Here:
https://github.com/Anirban166/testComplexity/blob/c991c31e5250bcaf804c3ad781fbc126c6a17e57/R/asymptoticMemoryUsage.R#L22
https://github.com/Anirban166/testComplexity/blob/master/R/asymptoticTimings.R#L22

Gabor
On Thu, Sep 3, 2020 at 6:42 PM Anirban <bloodraven166 at gmail.com> wrote:
#
Hi Anirban,

I don't think the issue is coming from the return statement at the end of your function. I think it's triggered by your "ifelse" statement, where you have "return" as the expression to be run if the condition isn't met.

A more idiomatic way of achieving what you're trying to do would be to use "stopifnot".

Best,


Max Turgeon
Assistant Professor
Department of Statistics
Department of Computer Science
University of Manitoba
maxturgeon.ca<http://maxturgeon.ca>
#
Thank you for the helpful replies! I got it now, I overlooked the return on
the ifelse() before.

Thanks a lot again!

- Anirban
On Thu, Sep 3, 2020, 11:18 AM Anirban <bloodraven166 at gmail.com> wrote: