Skip to content

source file on startup question - why does an old version of a function show up? ggplot or R?

3 messages · R. Michael Weylandt, stephen sefick

#
All,

1. I will try and make this clear and concise.  Please let me know any 
information that would be helpful in figuring out this problem (I don't 
know the relevant information to post).  I am on linux- see below for 
session information.

2. Problem:
working directory: home

an old version of a function is sourced into the R session and doesn't work

working directory: Desktop

the new version of the function is soured into the R session and works

3. I have setup a R_scripts folder that houses R scripts that I use on a 
regular basis, and I have set up my .Rprofile (below) to source these 
files when R is invoked.

What should I do?

.Rprofile:

###nothing yet###

print("It's go time")

#######################################################
#####source my R_scripts directory on start up#########
#######################################################

scripts2source <- dir("/home/user/R_scripts", full.names=TRUE)
R_scripts <- grep(".*\\.R$", scripts2source)
scripts2source <- scripts2source[R_scripts]

for(i in 1:length(scripts2source)){
   source(scripts2source[i])
}

#######################################################
#######################################################


#######################################################
################set help_type##########################
#######################################################

options(help_type="html")

#######################################################
#######################################################



R session:
R version 2.15.2 (2012-10-26)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
  [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
  [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8
  [7] LC_PAPER=C                LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_0.9.2.1

loaded via a namespace (and not attached):
  [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       grid_2.15.2
  [5] gtable_0.1.1       labeling_0.1       MASS_7.3-22        memoise_0.1
  [9] munsell_0.3        plyr_1.7.1         proto_0.3-9.2      
RColorBrewer_1.0-5
[13] reshape2_1.2.1     scales_0.2.2       stringr_0.6.1
#
On Fri, Nov 16, 2012 at 2:52 PM, Stephen Sefick <sas0025 at auburn.edu> wrote:
Sounds like you've perhaps got a saved session in the home directory
which is getting loaded after the profile and clobbering the newer
version which isn't loaded when starting in other working directories.
That or maybe there's redundancy in your startup scripts.... Wild
guesses really, but it might be it.

Cheers,
MW
#
Nothing like posting to the list to figure it out yourself.  defined the 
little sourcing function in .Rprofile as the .First file.  Now all is 
well.  Sorry for clutering everyones email boxes.
kind regards,

Stephen Sefick
On Fri 16 Nov 2012 08:52:00 AM CST, Stephen Sefick wrote: