[R-SIG-Mac] Question about file.path

Simon Urbanek simon.urbanek at r-project.org
Mon Jul 26 01:59:12 CEST 2010


On Jul 25, 2010, at 5:42 PM, Riccardo G-Mail wrote:

> Hi, my name is Riccardo, I'm a PhD student in Soil Science in University 
> of Florence (Italy), and I'm beginning to use R.
> I work both in a remote server and my own Mac, and so I use 
> /file.path()/ function according to where I must work:
> 
> /mainDir <-
>     file.path(
> 
> #"/Volumes/comune/RICERCA/Odori/ConfrontoDHS-SPME/AnalisiR") #remote 
> server 1
> 
> #"/Volumes/pesticidi/Ricerca/Odori/ConfrontoDHS-SPME/AnalisiR") #remote 
> server 2
>               "/Users/riccardoromoli/Documents/Università/Tesi 
> PhD/ConfrontoDHS-SPME/AnalisiR") my own Mac
> dataDir <-
>     file.path(mainDir, "Dati")
> workDir <-
>     file.path(mainDir, "report")/
> 
> When I use the /read.table/ function I have this error:
> 
> /df.AREE <- read.table(file.path(dataDir, "ORIGINALI", "SPME_H2O", 
> "AREE.txt"),
>                           sep = "\t",
>                           as.is = TRUE, dec=".",
>                           header= TRUE, fill=TRUE)[,-c(2, 5:15, 17:28, 
> 30:31)]
> /
> 
> *Error in file(file, "rt") : cannot open this connection
> In file(file, "rt") :
>   cannot open file '/Users/riccardoromoli/Documents/Università/Tesi 
> PhD/ConfrontoDHS-SPME/AnalisiR/Dati/ORIGINALI/SPME_H2O/AREE.txt': No 
> such file or directory*
> 
> Do you have any suggestion?
> 

Well, apparently that directory doesn't exist - that's what R tells you.
a) make sure you're running in the right locale (should be UTF-8 to support non-ASCII characters)
b) make sure the path actually exists (use drag & drop to avoid typing mistakes)

Cheers,
Simon



More information about the R-SIG-Mac mailing list