From h.wickham at gmail.com  Fri Apr  4 17:34:30 2008
From: h.wickham at gmail.com (hadley wickham)
Date: Fri, 4 Apr 2008 10:34:30 -0500
Subject: [Rd] __FILE__ for R
Message-ID: <f8e6ff050804040834k39b7871brd3a3a71de8d3d528@mail.gmail.com>

I've often missed the ability to get the directory of the currently
running script.  It's actually been possible for a while:

FILE <- (function() {
  attr(body(sys.function()), "srcfile")
})()

thanks to Duncan's recent changes to file parsing.  This is pretty
useful for sourcing in files relative to the current script, rather
than the working directory.

Hadley

-- 
http://had.co.nz/



[Rd] __FILE__ for R
hadley wickham