Mikael Jagan
2023-Jun-21 16:41 UTC
[Rd] New behavior when running script in package directory?
Surely this behaviour is just a case of ESS being "too clever", sourcing *.R files in special way when it detects that a file belongs to a package (loading dependencies automatically, etc.)? The function ss() is defined inside of .ess.source(), which is defined here: https://github.com/emacs-ess/ESS/blob/5c4ae91cefa5c56fd13b204a9a996825af836a67/etc/ESSR/R/.basic.R#L168 If you think that there is a bug, then you could report it there ... Mikael On 2023-06-21 6:00 am, r-devel-request at r-project.org wrote:> When I run a script foo.R containing some trivial code in my home > directory, via Emacs/ESS, everything works as expected: R > starts, and a setwd() command to set the working directory is > run automatically before the code in the script is run. > > But if I copy foo.R to some package/R directory strange > things happen. When I use Emacs/ESS to run the script > in its new location, R starts, and setwd() is called to set > the working directory, but then one or more libraries that the > package depends on are loaded, even though I am using no > libraries in foo.R. > > Now consider foo.R that contains the following trivial code: > secsToRDateTime <- function(secs) { > day2sec <- 60*60*24 > days <- secs/day2sec > } > > When I try to run this from package/R I get... > > Error in ss(file, echo = visibly, local = local, print.eval = output, : > /tmp/gpstime.R!CuSewT:2:0: unexpected end of input > 1: secsToRDateTime <- function(secs) { > ^ > > As I said, there are no problems when the script is run from my > home directory. This suggests that test scripts can no longer be > tested in a package's R directory? > > Is this true? > > Thanks, > Dominick
Martin Maechler
2023-Jun-22 14:28 UTC
[Rd] New behavior when running script in package directory?
>>>>> Mikael Jagan >>>>> on Wed, 21 Jun 2023 12:41:02 -0400 writes:> Surely this behaviour is just a case of ESS being "too clever", sourcing > *.R files in special way when it detects that a file belongs to a package > (loading dependencies automatically, etc.)? > The function ss() is defined inside of .ess.source(), which is defined here: > https://github.com/emacs-ess/ESS/blob/5c4ae91cefa5c56fd13b204a9a996825af836a67/etc/ESSR/R/.basic.R#L168 > If you think that there is a bug, then you could report it there ... > Mikael Indeed. I have now replied to this CC'ing to ESS-help at ... instead of R-devel at ... It's visible in the mailing list *archives* now: https://stat.ethz.ch/pipermail/ess-help/2023-June/013203.html Martin [.................]
Maybe Matching Threads
- New behavior when running script in package directory?
- elpa-ess fails to initialize after update to 18.10 on ubuntu bionic
- [R-pkgs] Release of ess 0.0.1
- [V2V PATCH 1/1] convert_windows: add firstboot script to install drivers with pnputil
- [V2V PATCH 1/1] convert_windows: add firstboot script to install drivers with pnputil