0

I want to open several files with R and therefore use the function choose.files(), which is frequently recommended here in stackoverflow for this purpose. Anyway, this does not work in my code, and I would be very happy if someone can tell me what`s wrong. This is the beginning of my code:

corpus1<-scan(choose.files(default="C:/Desktop/test", caption = "Select 
files", multi = TRUE))

... and this is the output:

Error in file(file, "r") : invalid 'description' argument
In addition: Warning message:
In if (file == "") file <- stdin() else { :
  the condition has length > 1 and only the first element will be used

Thanks in advance! M_Be

M_Be
  • 1
  • choose.files is for finding files interactively, which is not the way that you are using it. By interactively, I mean that you call the function choose.files() and it will open up a prompt for your to find the file that you want to open. Run choose.files() by itself and you will see what I mean. – Chris Oct 07 '15 at 12:56
  • So it is not possible to open more than one file with it? – M_Be Oct 07 '15 at 13:04
  • ...and this was interactively, as a prompt opened and I chose 3 files and then this error message came up – M_Be Oct 07 '15 at 13:07
  • you can open them one at a time, but not all at once. You can never open more than 1 file at a time in R. If you want to open multiple files programatically, you can use a for loop or apply function. – Chris Oct 07 '15 at 13:12
  • Thank you! I guess i was just confused by the word fileS, which suggerates to me that it is possible to open multiple files at the same time. – M_Be Oct 07 '15 at 14:16

0 Answers0