How to automate / loop read.table and plot for pdfs?

Hello guys!
I am relatively new to R and have a question:
I am looking for a way to automate the function read.table for all files in a directory and ultimately create a pdf for each result with the same name of the read file (also automated).

I use this line to read a table.
SampleID<-read.table("example1.txt", header=TRUE, sep="\t", fill = TRUE)
After that there is some other code and a loop in regards to read the data, change /adapt the table.
Finally I use this line to create pdfs

pdf("example1.pdf", paper="a4", width=8, height=11.2)# für pdf Output ST=Sample Table
opar<-par(no.readonly = TRUE) #Speichern der Graphik Output Bedingungen#

there is also a loop for input of data for the plot.
Mind you, I didnt write the code, so I am not completely aware of everything that is happening :).
I was wondering if with a slight change in the above lines of code, it's possible to automate the whole process rather than me manually changing the name example1 to example2 and so on and run the whole script manually each time.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.