[R] R looks for a folder not specified

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jan 17 13:00:05 CET 2011

On 16/01/2011 9:31 PM, l.chhay wrote:
> Dear R community,
> I have been getting this warning message after running a function sourced
> from an R script, and can't seem to work out why R is looking for a folder
> that wasn't even specified (it attaches a \NA to the specified directory,
> where assess_rev has not asked to do so at all. R code has been tested by
> another user and that works fine).
> I have tried saving the files in a new folder and onto a different drive,
> but that doesn't seem to fix the problem.. I have also checked to make sure
> that I've the appropriate access options.
> Has anyone encountered this problem where R starts looking for this
> non-existent \NA folder?
>> source("S:\\research\\boxcox\\Series_to_experiment_with\\Revisions_analysis\\assess_rev3.R")
>> assess_rev(data.dir="S:\\research\\boxcox\\Series_to_experiment_with\\Revisions_analysis\\NEPAL_JUL81_B1\\lam0\\",rev.lag=13,series="NEPAL_JUL81_B1",comp="adj")
> Error in file(file, "r") : cannot open the connection
> In addition: Warning message:
> In file(file, "r") :
>    cannot open file
> 'S:\research\boxcox\Series_to_experiment_with\Revisions_analysis\NEPAL_JUL81_B1\lam0\NA':
> No such file or directory
> (I am working from a Windows7 machine, using R 2.9.2.)

It looks as though something in the assess_rev function (which was 
presumably defined in that script you sourced) constructs a path from 
the data.dir argument and makes use of a missing value.  The missing 
value is converted to "NA" and is appended to the directory, and you see 
the error message.

Duncan Murdoch

More information about the R-help mailing list