Hi everyone. I am struggling with a for loop. I have 10 separate rows of text in a list file called text_objects. I have another object called title_text which contains the titles for each pdf I want to create. Here is latest version fo the for loop I have tried:
output_dir <-- "~/Downloads/"
for (i in 1:length(text_objects)) {
pdf(file = paste0(output_dir, title_text[i], ".pdf"))
print(text_objects[[i]])
dev.off()
}
I actually get all the named pdf files, but they are all only 4 kb each and non of them will open (damaged file). Sorry, but I can't seem to see what I have wrong, despite much searching. Any suggestions are greatly appreciated.
Thanks for the reply. It filled in some ideas for me, and now I have all the scraped pages saved as individual PDFs (went the markdown route). I also saved them as plain text files too, because, why not. Now I can check frequencies, associations, topics and others across a nice sized corpus. Thanks again for the suggestion.