Breakpoint in functions which are defined inside another function

OK - this one does not work:"

Hi

I can't set a breakpoint inside a function defined in another function. For example:

test <- function(x = emeScheme_gd) {

  # Calculate max ncol in list recursively ----------------------------------

  maxncol <- function(x) {
    if (is(x, "list")) {
      result <- sapply(
        x,
        maxncol
      ) %>% max()
    } else {
      result <- ncol(x)
    }
    return(result)
  }

  # Recursive function to do the splitting ----------------------------------


  # Return ------------------------------------------------------------------

  return(result)
}

03

It has no effect when I re-load the package.
Rstudio Version:
Version 1.2.1139
Build 1147 (ab65ba09)

Is this a bug?

Thanks,

Rainer

You can try using browser() directly to make sure it actually does what you want. Then you can step through your function step-by-step.
I don't remember having issues with it, just make sure to reload your package with devtools::load_all().

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If there are no other related issues, and you're working with the latest version of RStudio (see dailies here), you might consider filing an issue in the RStudio IDE GitHub repo. The guide below can be handy.

RStudio IDE Guide: Writing Good Bug Reports

Sure - and I did that, but this does not explain why setting the breakpoint via GI does not work, although it should.

I reloaded the package regularly, but no change in the buggy behaviour.