Hi Rich, I'm confused. It seems the error is that the file can't be found; if so, what does it matter what is in the file?
As far as I can see you are either not in the directory you think you are, or b) the file is not named what you think it is. Best, Ista On Fri, Oct 26, 2018 at 12:30 PM Rich Shepard <rshep...@appl-ecosys.com> wrote: > > I'm not seeing my error even after reading ?source and a couple of web > fora threads. Running R-3.5.1 on Slackware-14.2. > > The scripts/ directory has the file 'input-summarize.R' with these lines: > > sites <- read.table('../data/stations.dat', header=T, sep=',', > stringsAsFactors=T) > sink('../analyses/location-summaries.txt') > print(summary(sites) > sink(NULL) > > hg_conc <- read.table('../data/concentrations.dat', header=T, sep=',', > stringsAsFactors=T) > hg_conc$sampdate <- as.Date(as.character(hg_conc$sampdate)) > sink('../analyses/concentration-summaries.txt') > print(summary(hg_conc) > sink(NULL) > > Sourcing the script within the same directory (confirmed using getwd()) > fails with this error message: > > > source('input-summarize.R') > Error in file(filename, "r", encoding = encoding) : > cannot open the connection > In addition: Warning message: > In file(filename, "r", encoding = encoding) : > cannot open file 'input-summarize.R': No such file or directory > > I've used this same syntax to source scripts within the past month and > would like to understand this error so I can fix it now and avoid it in the > future. > > TIA, > > Rich > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.