If you read it in as a dataframe, then you can use 'split' to create the
subsets by PolyNam and then use 'lapply' to the result of 'split' to plot
it:

lapply(split(yourDF, yourDF$PolyNam), function(.poly){
    plot(.poly$Date, .poly$Total)
})


On Fri, Mar 30, 2012 at 5:16 AM, TwistedSkies <david.vicary@talbotuw.com>wrote:

> Hi Guys,
>
> I am trying to create 20 indivudual line graphs that will be updated on a
> weekly bases. I have managed to read in my data from SQL and defined my
> loop. I am having difficulty in plotting the data and I think it may have
> something to do with the way my data has been read in and maybe I need to
> change it in a dataframe?!
>
> Easch graph will be based on PolyNam, so this is defined in the loop, then
> the date will be X - Axis and the Total the Y-Axis.
>
> I have tried to upload the data as a .csv but it has been blocked so below
> is some sample data, if you would like me to e-mail it over to you then
> just
> let me know! Many Thanks for your help in advance
>
>
>
>                  PolyNam                                              Date
> Total
> 1      Australia_North_East_250km               2012-03-09    707304183
> 2      Australia_North_East_250km               2012-03-16    364042592
> 3      Australia_North_East_250km               2012-03-23    353652092
> 4      Australia_North_West_250km              2012-03-09    1332721712
> 5      Australia_North_West_250km              2012-03-16    1039809829
> 6      Australia_North_West_250km              2012-03-23    1039809829
> 7      Chile_North_250km                              2012-03-09
> 141406503
> 8      Chile_North_250km                              2012-03-16
> 101125272
> 9      Chile_North_250km                              2012-03-23
>  79043252
> 10    Dominican_Republic_Puerto_Rico       2012-03-09    321944081
> 11    Dominican_Republic_Puerto_Rico       2012-03-16    197842161
> 12    Dominican_Republic_Puerto_Rico       2012-03-23    184308866
> 13    FL_CBX_250km                                      2012-03-09
> 108743687
> 14    FL_CBX_250km                                      2012-03-16
> 54371843
> 15    FL_CBX_250km                                      2012-03-23
> 62259843
> 16    Greece_Athens_250km                        2012-03-09    81823979
> 17    Greece_Athens_250km                        2012-03-16    42513139
> 18    Greece_Athens_250km                        2012-03-23    42513139
> 19    Hong_Kong_250km                               2012-03-09    31929125
> 20    Hong_Kong_250km                               2012-03-16    222436862
> 21    Hong_Kong_250km                               2012-03-23    222436862
> 22    Lebanon_Jerusalem_250km                2012-03-09    229025783
> 23    Lebanon_Jerusalem_250km                2012-03-16    137147675
> 24    Lebanon_Jerusalem_250km                2012-03-23    113036204
> 25    Mexico_Mexico_City_250km                2012-03-09    217923016
> 26    Mexico_Mexico_City_250km                2012-03-16    108961508
> 27    Mexico_Mexico_City_250km                2012-03-23    108961508
> 28    New_Zealand_Christchurch_250km   2012-03-09    135376966
> 29    New_Zealand_Christchurch_250km   2012-03-16    68064202
> 30    New_Zealand_Christchurch_250km   2012-03-23    68064202
> 31    New_Zealand_Wellington_250km      2012-03-09    16157602
> 32    New_Zealand_Wellington_250km      2012-03-16    7972088
> 33    New_Zealand_Wellington_250km      2012-03-23    7972088
> 34    Panama_Panama_City_250kms          2012-03-09    277630042
> 35    Panama_Panama_City_250kms          2012-03-16    260942688
> 36    Panama_Panama_City_250kms          2012-03-23    249112188
> 37    Peru_Lima_250km                               2012-03-09    342099837
> 38    Peru_Lima_250km                               2012-03-16    252701245
> 39    Peru_Lima_250km                               2012-03-23    257780890
> 40    Peru_South_East_250km                     2012-03-09    217545181
> 41    Peru_South_East_250km                     2012-03-16    118772591
> 42    Peru_South_East_250km                     2012-03-23    108772591
> 43    Philippines_Manilla_250km                2012-03-09    71038944
> 44    Philippines_Manilla_250km                2012-03-16    35519472
> 45    Philippines_Manilla_250km                2012-03-23    35519472
> 46    Santiago_250km                                  2012-03-09
>  37031152
> 47    Santiago_250km                                  2012-03-16
>  18515576
> 48    Santiago_250km                                  2012-03-23
>  18515576
> 49    Taiwan_250km                                    2012-03-09
> 501738165
> 50    Taiwan_250km                                    2012-03-16
> 250295303
> 51    Taiwan_250km                                    2012-03-23
> 277197503
> 52    Turkey_Istanbul_250km                     2012-03-09     127543804
> 53    Turkey_Istanbul_250km                     2012-03-16     81947417
> 54    Turkey_Istanbul_250km                     2012-03-23     81947417
> 55    US_Los_Angeles_250km                     2012-03-09     743519687
> 56    US_Los_Angeles_250km                     2012-03-16     387822959
> 57    US_Los_Angeles_250km                     2012-03-23     371759844
> 58    US_San_Francisco_250km                  2012-03-09    595288671
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Multiple-line-Graphs-tp4518505p4518505.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

	[[alternative HTML version deleted]]

