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.

Reply via email to