I have to be either blind or stupid, but I cannot move forward with this:
I have a variable sourceName defined as:
sourceName = file.path(dataDatabase, dates[1], paste0(exchange, "_", ticker, "_trade.csv"))
which is this string:
"/home/malejg/goxtrader/data/2014-12-12/Bitfinex_BTC_trade.csv"
When I check the existenece of the file, I got the following result:
> file.exists(sourceName)
> [1] TRUE
so the file definitely exists. But when I use the above code in the if statement going like:
if(file.exists(sourceName)){
some sample code here}
it throws an error:
Error in if (file.exists(sourceName)) { : argument is of length zero
How is it possible? The code works fine on Windows, so is there some Linux related problem?
SESSION INFO:
sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-pc-linux-gnu (64-bit)
locale: [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=Cattached base packages: [1] stats graphics grDevices utils
datasets methods baseother attached packages: [1] data.table_1.9.4 xts_0.9-7
zoo_1.7-11loaded via a namespace (and not attached): [1] chron_2.3-45
grid_3.1.2 lattice_0.20-30 plyr_1.8.1 [5] Rcpp_0.11.5
reshape2_1.4.1 stringr_0.6.2 tools_3.1.2
file.exists
returning an object of length zero? have you tried a trivial block likeif (file.exists(sourceName))print('hello world')
– Jthorpe