Elen Heler
Elen Heler

Reputation: 11

Enter a Csv-File through a Pop-up Window in R

I have seen that there is the nice option to enter an input through a pop-up window which has been created in R.

Is it possible to write a code that creates a pop-up window (or maybe any other nice interface) where one can enter a csv file? (or excel file.) Would it also be possible to then get an output as a csv or excel file?

I'm thankful for any idea since I'm not sure what is possible in which language. If you think things would be easier in python - let me know. I just thought to work with data frames is very easy in R.

I already explored a bit the package svDialogs

There is for example the function dlgInput() which can take as an input some integer and there are also functions such as dlg_form() etc which do similar things. But I don't find a function that would take a csv file or so as an input.

Upvotes: 1

Views: 1464

Answers (1)

Yifu Yan
Yifu Yan

Reputation: 6106

You can use rstudioapi:

rstudioapi::selectFile("Select File") returns the file path of your select file, to open a csv interactively, you can use following code:

read.csv(rstudioapi::selectFile("Select File"))

You can read more at: https://rstudio.github.io/rstudioapi/reference/file-dialogs.html

Upvotes: 1

Related Questions