آدم قنوات
آدم قنوات

Reputation: 161

How can read files from directory using R?

What I need to do is read in all files with *.json from multiple folders and store the results in a data.table

I have a folder named ROOT that contains two folders A and B. The A and B also contain folders from A to Z where the *json files are located.

how can do this with a lot of folders inside each other?

Upvotes: 0

Views: 120

Answers (1)

hackR
hackR

Reputation: 1479

try this:

list.files(path = "c:/users/YOURNAMEGOESHERE/documents", pattern = "json", recursive = TRUE) 

first change the path to the folder you want. For example, in MS Windows, change YOURNAMEGOESHERE to your own name, or whatever is appropriate. The argument recursive allows the search to be done in all subfolders.

Upvotes: 3

Related Questions