.First <- function(install=FALSE,write=TRUE,update=FALSE){ # this is file dotFirst.R from Website .../statoed for sand version 1.4 # if you have write permission in the R folder change write to TRUE # if you have sand Version 1.0,1.1 , 1.2 or 1.3 installed change update to TRUE # this file should be in folder where sand_1.4.zip is located # If write is FALSE, i.e. you DO NOT have write permission in # the folder where the R Program is installed CHANGE THE NEXT # LINE (line 9) TO MATCH THE PATH TO THE FOLDER IN Step a path_to <- "C:/Documents and Settings/User Name/My Documents/Myrlib" # NOTE the use of / instead of \ in path_to # # save this file exit Notepad and proceed with Step h # options(warn=-1) if(!write) { .libPaths(path_to) # this is where the sand package will be installed cat("\n Packages will be installed in \n",path_to,"\n") } # IT MAY BE NECESSARY TO UNINSTALL OLD VERSION # REMOVE the # FROM NEXT LINE TO DO THIS # if(install && update ) uninstall(sand) # ERROR in next three lines corrected on 16 May 07 if(install && update) detach("package:sand") if(install) install.packages("sand_1.4.zip",.libPaths()[1] ,repos=NULL) # } before correction error occurs if install is TRUE and update = FALSE # # AFTER SAND HAS BEEN INSTALLED # the next line will attach the sand library to the current R Session library(sand) options(editor="Notepad") # use Notepad as editor in R options(warn=0) # # add additional options as desired # # NOTE: if you have data that you want to analyze using # the sand package in folder pathto\ADCdata make a copy of the R # shortcut in folder pathto\ADCdata, follow Steps 2 d and e # # Run R by double clicking on the R-Icon in pathto\ADCdata # Left click on File in upper left corner of the R Console and # select Source R code and navigate to folder rmain and # select dotFirst.R (this will read this function into current # working folder.) Once dotFirst.R is sourced in type: # .First() and press [Enter] on the R command line. # YOU ONLY NEED TO DO THIS THE FIRST TIME YOU RUN R IN A NEW FOLDER # This file revised for sand 1.4 on Nov24 2009 }