[R] file.exists() on device files

Benjamin Tyner btyner at gmail.com
Wed Jan 11 11:12:43 CET 2017


Hi,

On my linux machine (Ubuntu, and also tested on RHEL), I am curious to 
know what might be causing file.exists (and also normalizePath) to not 
see the final device file here:

    > list.files("/dev/fd", full.names = TRUE)
    [1] "/dev/fd/0" "/dev/fd/1" "/dev/fd/2" "/dev/fd/3"
    > file.exists(list.files("/dev/fd", full.names = TRUE))
    [1]  TRUE  TRUE  TRUE FALSE
    > normalizePath(list.files("/dev/fd", full.names = TRUE))
    [1] "/dev/pts/2" "/dev/pts/2" "/dev/pts/2" "/dev/fd/3"
    Warning message:
    In normalizePath(list.files("/dev/fd", full.names = TRUE)) :
      path[4]="/dev/fd/3": No such file or directory

    > sessionInfo()
    R version 3.2.5 (2016-04-14)
    Platform: x86_64-pc-linux-gnu (64-bit)
    Running under: Ubuntu 16.04.1 LTS

    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=C

    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods base

Regards
Ben



More information about the R-help mailing list