From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: [PATCH] read.table in variable transfer caused sometimes "function not found" error - small change Date: Wed, 8 Oct 2014 14:34:49 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xbyst-0004Sn-RY for emacs-orgmode@gnu.org; Wed, 08 Oct 2014 17:35:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xbysn-0005Fd-03 for emacs-orgmode@gnu.org; Wed, 08 Oct 2014 17:34:59 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:37529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xbysm-0005FT-Nn for emacs-orgmode@gnu.org; Wed, 08 Oct 2014 17:34:52 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: emacs-orgmode@gnu.org On Wed, 8 Oct 2014, Rainer M Krug wrote: > "Charles C. Berry" writes: > >> On Wed, 8 Oct 2014, Rainer M Krug wrote: >> >>> "Charles C. Berry" writes: >>> >>>> On Mon, 6 Oct 2014, Rainer M Krug wrote: >>>> >>>>> Hi >>>>> >>>>> The variable transfer of tables from org to R caused sometimes 'could >>>>> not find function "read.table"' errors (e.g. when the file was tangled >>>>> into a ./data directory which was loaded by the function >>>>> devtools::load_all("./")). This can easily be fixed by adding the package >>>>> name to the call in R, i.e. replacing =read.table()= with >>>>> =utils::read.table()= which is done in this patch. >>>> >>>> It does fix that one case. >>>> >>>> But I wonder if that is the best way. >>>> >>>> The heart of the matter is that load_all eventually calls sys.source, >>>> which can be persnickety about finding objects on the search path. See >>>> ?sys.source. >>>> >>>> If the src block you tangle to ./data/ has any code that uses any >>>> other objects from utils, stats, datasets or whatever, you will be in >>>> the same pickle. >>> >>> Exactly - that is true. But it is the same when putting this in a >>> package (as far as I am aware). >>> >> >> Do you mean that putting `x <- rnorm(10)' into a data/*.R file will >> fail when you try to build and check? >> >> In fact, `R CMD build' will execute it and save the result as a >> data/*.rda file. And check will go through. >> >> devtools::load_all (calling load_data) fails to do that. Which is why >> I think this is a devtools issue. > > OK - point taken. But I still think that the =utils::read.table()= would > not hurt, rather make the variable transfer safer. > What you want to change is in a defconst. So, the user can override with a file-local version. So, making the change really is harmless. Maybe add a note to the docstring to say that using `utils::read.table' assures that `read.table' always can be found just in case anyone ever asks. Chuck