[R-pkg-devel] Browser Level for Conditional Function Parameter

Dario Strbenac dstr7320 at uni.sydney.edu.au
Thu Aug 20 07:00:06 CEST 2015


Good day,

Why do I get a debug message and a change in browser level when I inspect the title variable ? For the comparison variable, it simply prints its value and remains at level 1.

aFunction <- function(comparison = c("within", "classifier", "selection"),
                      title = if(comparison[1] == "within") "Internal" else "Between")
{
    browser()
    require(ggplot2)
    comparison <- match.arg(comparison)
    ggplot(mtcars, aes(wt, mpg)) + geom_point() + ggtitle(title)
}

aFunction()

Browse[1]> title
debug at #4: [1] "Internal"
Browse[3]>

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia


More information about the R-package-devel mailing list