rrstudiospecial-charactersmicrosoft-file-explorer

Managing R-created files (that are invisible) in Windows File Explorer


I am using an R package which by default saves run-time outputs as CSV with the @ symbol in the filename. These files are not visible in File Explorer, but they can be seen with dir() at RStudio's command prompt, and can be opened using RStudio's 'import dataset' menu, which opens a very File-Explorer-like view.

My question is, can I manage these files using File Explorer?

In other words, how do I get the mentioned RStudio's File-Explorer-like view as an actual Windows File Explorer view? Selecting the Hidden Items check box has no effect.

The R package is kml running within the latrend wrapper package. I don't think there's an option to change the output format, but guidance welcome.

1st EDIT: just a thought - I assume it is the @ symbol that is doing the invisibility trick. Maybe it is something that R or RStudio is doing?

2nd EDIT: My humble apologies! The previous description was not complete (now clarified, hopefully). latrend is a wrapper for the culprit package kml (among other things).

What follows is the requested example with the relevant output following the dir() command. These files are for me not visible in Explorer.

It is also now clear to me that it is not the @ that is the cause, as I previously thought! I have changed the title of this question.

library(kml)

### generate some dummy data
SOtest <- generateArtificialLongData(25)

### quick result
kml(SOtest,3,10)

## open graphics window for manual selection
x11()
choice(SOtest) ## 'space' to select; 'm' to exit

## to close graphics window
dev.off()

dir() ## show folder contents <snipped>
# [42] ...
# [43] "SOtest-C3-1-Clusters.csv"                                                                    
# [44] "SOtest-C3-1-Details.csv"                                                                     
# [45] "SOtest-C3-1-Traj.bmp"                                                                        
# [46] "SOtest-C3-1-TrajMean.csv"
# [47] ....

Solution

  • Yup - thanks to Konrad for the idea!

    The user guide describes setting a temporary folder, in my case looking something like C:\Users\<....>\AppData\Local\Temp\Rtmp<....> where the files are actually accessible by Explorer.

    The clue, though not the relevance/importance, is in the following kml user guide code...

    wd <- getwd()
    setwd(tempdir()); getwd()
    ## ... do stuff ... ##
    setwd(wd)
    

    Where things are being stored without this step remains a bit of a mystery (to me!), as it looks like the output is in the current getwd() context, accessible from within RStudio without a directory change.