Hi all -

Long-time user, first-time poster.

I added a .First function to my Rprofile.site file to check for updates, clean 
the console, and put some fun quotes on startup.  This used to work without 
error.  I hadn't used R (which I usually play with in RStudio) in a few weeks, 
but when I started up recently and updated (R 3.1.0+ RStudio v 0.98.945),I got 
a couple error messages.  For context, here is my .First function:

.First <- function(){
    suppressPackageStartupMessages(library(installr))
    library(installr)
    library(stats)
    old.packages = installed.packages()[,1]
    save(old.packages, 
file="C:/Users/Owner/Documents/R/installedPackages.Rdata")
    # load("C:/Users/Owner/Documents/R/installedPackages.Rdata")
    # pull.packages = installed.packages()[,1]
    # for (i in setdiff(old.packages, pull.packages))
    # install.packages(i)
    updateR()
    cat("\014")
    if (runif(1,0,1)>0.5) {
      cat("Stately, plump Buck Mulligan...")
    } else cat("as though\nyou were creating\na mathematical sandwich")
  }


I was getting an error message about installr, but I added the suppress... 
function as suggested in that error message, which worked like a gem.  However, 
I can't quite figure out how to address the other error message.  Here it is:

Error installing package: Error in winDialog(type = "ok", message = 
message_text) :  winDialog() cannot be used non-interactively
Calls: .First -> updateR -> check.for.updates.R -> winDialog
Execution halted
I'm not sure what's going on here, but I'm guessing R runs .First functions in 
non-interactive mode.  I ham-handedly tried adding an > interactive=T line to 
the .First function, but this didn't work.

Any suggestions would be much appreciated.

=)  Brian
 
Brian Alexander Chalfant
Research Assistant & PhD student
University of Pittsburgh
www.pitt.edu/~bac84
ba...@pitt.edu
724.984.7758
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to