Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(glue)
- participants <- c(1:30)
- tasks <- c("a", "b", "c")
- sessions <- c(1:20)
- # Loop through participants, task, sessions
- for (id in participants) {
- for (task in tasks) {
- for (session in sessions) {
- # Set an individual filename
- file_name <- file(glue("P{id}_T{task}_S{session}.txt"))
- # Define the content of the text file
- this_text <- "Your text here"
- # Write to file
- writeLines(this_text, file_name)
- # Close file
- close(file_name)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement