[R] how to update R files included as"source" ?

Keith Jewell k.jewell at campden.co.uk
Mon Mar 29 18:27:09 CEST 2010


Hi,

I'm afraid I really don't have time to enter into a dialogue :-{ but this 
fragment from a function of mine might help...
----------------------
      outfile <- sub("Rd$", "html", hfile, ignore.case=TRUE)  # name of 
corresponding html
      out.mod <- file.info(outfile)[,"mtime"]  # if html absent or needs 
updating
      if (is.na(out.mod)||file.info(hfile)[,"mtime"] > out.mod) 
tools::Rd2HTML(hfile, outfile, .Package) # do it
-----------------------
The third line (inter alia) checks the modification time of the 'target' 
file and decides whether to process it.

Hope that helps,

Keith J
---------------
"arnaud chozo" <arnaud.chozo at gmail.com> wrote in message 
news:caebefd51003290824m67bebf96wd61315359ae972e4 at mail.gmail.com...
> Hi all,
>
> I have a main file main.R in which I include some other R files. For
> example, in main.R I have: source("functions.R").
> When I modify the file "functions.R", I'd like R to take into account the
> changes and to reload the file functions.R when I run main.R
> Is it possible?
>
> Thanks,
> Arnaud
>
> [[alternative HTML version deleted]]
>



More information about the R-help mailing list