Closed hlms closed 3 years ago
eval("Sys.glob('...')")
is probably your friend here. Don't forget you can use all facilities of R.
@s-u , I do NOT have much information about R.
I have an R user credentials.
Need to write a java program which displays the list of files/directories available on the server on which R is installed (using R user credentials only). User would navigate through the directories, and would select one file. My java code would fetch the file.
If the R instance has R serve package installed, my java code can use REngine.jar and use list.files and list.dirs commands in eval():
Will need to manipulate the output of this two commands to generate a single list. A wrapper java program can be written using these two commands so that user will be able to navigate through the files/directories.
It is easy for linux server. There is one tree of files - linux file-system.
It gets tricky when R instance is on a windows machine. Need to get the list of drives on the machine:
> system("cmd.exe /c wmic logicaldisk get name", intern = F)
Name
C:
D:
Need to check the OS as following:
> .Platform$OS.type
[1] "windows"
So, the flow differs based on underlying OS - windows or unix-like.
Using RConnection#openFile(String filepath), a user can open a file on the Rserve for reading.
Is there a way get the list of all files available?
Need to browse through the files available. Then I can pick one file for reading.