Quantcast
Viewing latest article 2
Browse Latest Browse All 3

Answer by DataM for I have R code to extract information from one document. How do I loop that for all the documents in my folder?

I'm not using a loop but using lapply and a function has the same behavior of a loop :

my_path <- "C:/Users/SAID ABIDI/Desktop/test/"my_a <- list.files(path = my_path)my_function <- function(x) {  read_file(paste(my_path, my_a[x], sep = ""))}my_var <- lapply(1:length(my_a), my_function)

Does this help you ?


Viewing latest article 2
Browse Latest Browse All 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>