[Rd] Warning when sourcing file after require

From: David Hastie <david.hastie_at_rsimony.com>
Date: Wed, 18 Jul 2012 18:36:44 +0100


Hi

I have recently upgraded to R 2.15.1. Since the upgrade, I am getting some odd behaviour that I don't understand. If I source a file which has a function with a require (or library) statement in it, then the first time I source it behaves as expected. If I then call the function (so that the require statement is evaluated) the function also runs ok. However, if I then subsequently try to source the file again I get an .Internal(eval.with.vis) warning.

At first I obviously thought it must be an error of mine in the file containing the functions I had written. However, subsequent tests show that even if the following code

foo<-function(){

   require(XML)
   cat("This is a test fn\n")
}

is put in the file foo.R, then running the following code gives the warning.

> source('foo.R')
> foo()

Loading required package: XML
This is a test fn
> source('foo.R')

Warning message:
In eval.with.vis(ei, envir) :
  .Internal(eval.with.vis) should not be used and will be removed soon

The key part to this is the inclusion of the require statement. If the require statement was not in the function, then there are no warnings. I experience this behaviour on my desktop running Ubuntu 12.04 and on my Mac running OSX. From looking at the change log of 2.15.1 I notice that the way files are sourced has changed (and seems to relate to this warning), but it is not clear to me what if anything this means I should change.

I would be grateful for any tips.

Kind regards
Dave

--
David Hastie, Ph.D.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 19 Jul 2012 - 11:29:17 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Jul 2012 - 12:40:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive