[Solved] Creating multiple files in R with a content inside [closed]


Use a for loop and write_lines for example:

for(i in 1:100) { 
  write_lines("Hello World", path = sprintf("file%s.txt", i))#
}

or use mapply

mapply(write_lines, path = sprintf("file%s.txt", 1:100), x = "Hello World")

1

solved Creating multiple files in R with a content inside [closed]