I am trying to plot graphs by loop.
Input data: Tables, which have the same ending *depth.txt, there are 2 tab delimited columns in the table:
Baba"\t"58.38
Tata"\t"68.38
Mama"\t"30.80
jaja"\t"88.65
OUTPUT: I would like to get a jpeg file with plot()
for each *depth.txt (their names will be the same as the tables' names) for all files (axis x will be the first column from the table and axis y will be second column)
I created a part of the script, but it doesn't work:
files <- list.files(path="/home/fil/Desktop/", pattern="*depth.txt", full.names=T,recursive=FALSE)
for (i in 1:length(files))
plot(read.table(files[i],header=F,sep="\t")$V1,read.table(files[i],header=F,sep="\t")$V2)
dev.copy(jpeg,filename=files[i])
dev.off
It doesn't work, could you help me please? I am a beginner with R.
renameing the file?
Will the following do what you want?
Similar to the first two but changing the file name for the plots