[R] Plotting multiple table automatically

Jim Lemon jim at bitwrit.com.au
Fri Feb 19 12:58:21 CET 2010


On 02/19/2010 10:32 PM, KennyL wrote:
>
> Hi All,
>
> I have a slight issue getting R to plot a series of tables automatically.
> Essentially I have a series of tables that I wish to plot. They are named
> on_2, on_3 etc. based on the file name when they were read in. I have
> filelist<- list.files() to give me list of the table names. I wish to plot
> each table, so I was thinking along some kind of for loop as below:
>
> for (i in 1:Number_Files) {
> plot(filelist[1])
> }
>
> With a few other bits a pieces, however obviously this tries to plot the
> character string in filelist, any ideas on how to get R to read the
> identically named table and plot that?
>
Hi Kenny,
It's a bit hard to tell without seeing the data, but I think you may 
have the table in text form in the file, so you probably want something 
like:

for(i in 1:Number_files) {
  tabledata<-read.table(filelist[i])
  plot(tabledata,...)
}

But the reading in will depend upon what format the data are in the files.

Jim



More information about the R-help mailing list