Tuesday, 15 March 2011

r - File.exists() doesn't work -


I have to be either blind or stupid, but I can not go ahead with it:

I have defined as a variable SOURCENAME:

  SOURCENAME = file.path (dataDatabase, date [1], paste0 (exchanges, "_", ticker "_trade .csv "))  

who is this string:

 " /home/malejg/goxtrader/data/2014-12-12/Bitfinex_BTC_trade.csv " 

When I look at the existence of the file, I found the following result:

  & gt; File.exists (sourceName) & gt; [1] True  

That's why the file definitely exists. But when I use the above version like an I statement:

  if (file.exists (sourceName)) {some sample code here}  

It throws an error:

  error (file.exists (sourceName)) {: the length of the argument is zero  

how is it possible is? Code works fine on Windows, so is there some Linux related problem?

Session information:

sessionInfo () R Version 3.1.2 (2014-10-31) Platform: x86_64- pc- linux- GNU (64-bit)

location: [1] LC_CTYPE = en_US.UTF-8 LC_NUMERIC = C
[3] LC_TIME = en_US.UTF-8 LC_COLLATE = en_US.UTF-8 [5 ] LC_MONETARY = en_US.UTF-8 LC_MESSAGES = en_US.UTF-8 [7] LC_PAPER = en_US.UTF-8 LC_NAME = C [9] LC_ADDRESS = C LC_TELEPHONE = C [11] LC_MEASUREMENT = en_US.UTF-8 LC_IDENTIFICATION = C

attach base packages: [1] Statistics graphics grDevices utils
dataset methods based

other packages attached: [1] data. table_1.9.4 xts_0.9-7 / zoo_1 .7-11

Loading through the namespace (and not attached): [1] chron_2.3-45
grid_3 .1.2 Latiss_0k20-30 Pliyr_lk8kl [5] Arseepeepi_0kllk5
Rijhep 2_lk4kl Stringr_0k6k2 tools .1.1.1

  if (isTRUE (file)     .exists (sourceName)) {cat ('found')}  

No comments:

Post a Comment