Hi, @scottyd22 , thank you very much for your tip! It has worked! In order to save these documents I need to use the write.table function? I have used:
#> Save each document with reversed columns
write.table(lista_df2, sep = “ ”)
but it's not working. Should I add something to this function?
One approach would be to create a function to step through that writes each file to your desired location. In the example below (which only has 2 tables), the write_files() function will take each newly created table, generate a "filepath" name, write the table to the desired location with the new name, and then return a success message. The message is not necessary, but nice to see after executing the lapply.
# function to write each table, based on index 'i'
write_files = function(i) {
# name each table "table_i.txt"
filepath = paste0('your_desired_location/table_', i, '.txt')
write.table(x = lista_df2[[i]], # the i-th table in lista_df2
file = filepath,
sep = ' ')
# output message
message = paste0('table_', i, ' success!')
return(message)
}
# step through all indexes (1 to length of list)
outcome = lapply(1:length(lista_df2), write_files)
outcome
#> [[1]]
#> [1] "table_1 success!"
#>
#> [[2]]
#> [1] "table_2 success!"