Execute a function from package after doing library(pkg)
function, load, package, r
Solution
I think you want `.onLoad` which you dump in a .R file called zzz.R (traditionally). Here's an example where I've used this: github.com/trinker/gmailR/blob/master/R/zzz.R
Problem
Hi I have a package with a functions that makes a gui with gWidgets, is there a way I can get this to be executed on package load so the interface comes up straight away. I thought something like this: ``` .OnAttach <- function(libname, pkgname){ gui() } ``` would work, but I'm still learning about hooks, and the events during package load and unload, and R environment stuff. EDIT: This is what I currently have in my zzz file: ``` .onLoad <- function(libname = find.package("GspeEaR"), pkgname = "GspeEaR") { gui() } ``` Thanks, Ben W.