If you want to read in all the files and then set the range so you can print a parameter from each one on a single chart, there is some information in the archives about how to do this. A brief outline is below (definitely untested)
allFiles <- lapply(fileList, read.table, header=TRUE, ... other parameters) xRange <- range(sapply(allFiles, '[[', 'xParm')) # column with data of interest yRange <- range(sapply(allFiles, '[[', 'yParm')) plot(0, xlim=xRange, ylim=yRange, type='n') # setup the plot lapply(allFiles, function(.file) lines(.file$xParm, .file$yParm)) # plot all the line On Wed, Nov 10, 2010 at 1:38 PM, Sebastian Gibb <li...@sebastiangibb.de> wrote: > Am Mittwoch, 10. November 2010, 19:22:38 schrieb Nasrin Pak: >> My problem is that I have a data set for every day of measurement in a >> seperate file and I want to plot one parameter of the data for all the days >> in one graph. I tried to use for loop but only the last data remains in the >> program memory, I don`t know how to plot each day`s data continusly after >> the others(or how to extending the x axis.) Would you please help me with >> it? >> >> This a plot for one day: >> >> radiation.data >> <-read.table("C:/updated_CFL_Rad_files/2008/RAD_2008_JD101_0410.dat", >> header = TRUE,sep = ",", quote = " ", dec = ".") >> >> > attach(radiation.data) >> >> The following object(s) are masked from 'radiation.data (position 3)': >> >> Batt_avg, Batt_st, Day, Hour, Kdown_avg, Kdown_st, LW_in, LW_in_st, >> Minute, Month, PanelT_avg, PanelT_st, PAR_avg, PAR_st, Sec, >> Tcase_avg, Tcase_st, Tdome_avg, Tdome_st, Thermopile_avg, >> Thermopile_st, Tuv_avg, Tuv_st, Uva_avg, Uva_st, Uvb_avg, Uvb_st, >> Year >> >> > names(radiation.data) >> >> [1] "Year" "Month" "Day" "Hour" >> [5] "Minute" "Sec" "Batt_avg" "PanelT_avg" >> [9] "Batt_st" "PanelT_st" "Kdown_avg" "Thermopile_avg" >> [13] "Tcase_avg" "Tdome_avg" "LW_in" "PAR_avg" >> [17] "Tuv_avg" "Uvb_avg" "Uva_avg" "Kdown_st" >> [21] "Thermopile_st" "Tcase_st" "Tdome_st" "LW_in_st" >> [25] "PAR_st" "Tuv_st" "Uvb_st" "Uva_st" >> >> plot(((PAR_avg*0.216)/Uvb_avg), >> main="Par/UVB",xlab="minutes",ylab="Par/UVB") >> >> >> and this is the algorithm I tried for plotting all the data in one plot: >> >> x<- matrix( list.files("C:/updated_CFL_Rad_files",full=TRUE)) # putting all >> data sets in a matrix >> for(i in 1:100) { >> if(i < 101) next >> radiation.data <-read.table(x[i], header = TRUE,sep = ",", quote = " >> ", dec = ".") >> attach(radiation.data) >> plot(i*Hour*60+Minute,PAR_avg,main="PAR",xlab="Hour",ylab="Par") >> dev.print(device=postscript, "C:/graph5.eps", onefile=FALSE, >> horizontal=FALSE) >> } >> The plot I see is the last file's plot, I don't know how to keep previous >> data and continue within the same plot. > > Hello, > > use something like this: > plot(0, 0, type="n", xlim=c(0, maxTime), ylim=c(minY, maxY)) > > for ( i in 1:100) { > lines(x[i], y[i]); > } > > ?plot > ?lines > ?points > > Bye, > > Sebastian > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.