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

Berry Boessenkool berryboessenkool at hotmail.com
Thu Aug 20 13:06:16 CEST 2015


I always get the browser level change in combination with if-statements...

You haven't by change at some point in time set
debug(aFunction)
If so, set
undebug(aFunction)

Berry


> From: dstr7320 at uni.sydney.edu.au
> To: r-package-devel at r-project.org
> Date: Thu, 20 Aug 2015 05:00:06 +0000
> Subject: [R-pkg-devel] Browser Level for Conditional Function Parameter
> 
> 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
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list