Thank you for trying to improve your question, but it's still
impossible to help: the problem is almost certainly in this block of
code:
############ plotting##############
year <- 2005:2008
month<-
("jan","Feb","March","".........."Dec")
for ( y in year)
for (m in month)
here I use Sp plot and plot map
}
}
but given that the plotting code isn't here, it's hard to say what's
wrong with it. If I had to guess, I'd suggest three possibilities:
i) If you are getting the last plot consistently, it could be that you
are overwriting your plot (you never said what device you are using or
how you plan to deal with 48 plots)
ii) You are referring to "year" and "month" in your loop,
rather than y and m.
iii) There are braces missing (there certainly are some from your
code) so you aren't actually getting a real loop.
Try to reread what I said about minimal reproducible examples in the
other thread.
Michael
On Fri, Feb 17, 2012 at 5:08 AM, uday <uday_143_4u at hotmail.com>
wrote:> I have two different datasets
> 1) is in monthly format (obs)
> 2) yearly format (model)
>
> in obs I have 84 files ( 2003:2009)for different months & in model I
have 4
> different files which has yearly data (2005:2008)
>
> So for calculating my requirement I need these both data sets.
> The sample calculations are as follows
>
> file_o<-list.files(path=' ', pattern="0.2.text") #
total number of files are
> 80
> for ( i in 1:file_o){
> #get data ?here I get
> ? ? Lat_o<-
> ? ? Lon_o <-
> ? ?time_o<-
> ? ? gas_o<-
> }
>
> file_t< list.files(path=' ', pattern="fg.nc")
> for (j in 1:file_t){
>
> #get data ?here I get
> ? ? Lat_t<-
> ? ? Lon_t <-
> ? ?time_t<-
> ? ? gas_t<-
> }
> nobs<- length(Lat_o)
> for (k in 1:nobs){
>
> # here it does some calculation and get some value which is ?" gas_new
"
> }
>
> now I would like to plot this data for every month according to my
> observation data
>
> ?############ plotting##############
> year <- 2005:2008
> ? ? ? ?month<-
("jan","Feb","March","".........."Dec")
> for ( y in year)
> for (m in month)
> here I use Sp plot and plot map
> ? ? ?}
> }
>
> what I would like to do is I want to plot data according to my observations
> taken ( its in month)
>
> but when I run my codes it plots same file from2005:2008 but it suppose to
> plot 48 different files for different months.
>
> I got stuck here, I am quit new in R.
> ?it would be very nice it somebody can tell me how to fix this problem.
>
>
> Uday
>
>
>
>
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Plotting-issue-tp4396832p4396832.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.