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.) Thanks! -- View this message in context: http://r.789695.n4.nabble.com/R-looks-for-a-folder-not-specified-tp3220637p3220637.html Sent from the R help mailing list archive at Nabble.com.
On 01/17/2011 01: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 >Hi Leanne, I thought it was the line break in the directory string, but the line wasn't broken when I started to answer. My next guess is that you don't need the trailing "\\" on the directory string. Jim
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