Hi all, I have a couple of questions.

1) Is there a more effective way to remove the following pattern
(patternrm) from the station_id_Timeseries (see below)

patternrm <- c(_2000_4_OND, _2001_1_JFM, _2001_2_AMJ, _2001_3_JAS,
_2001_4_OND, _2002_1_JFM, _2002_2_AMJ, _2002_3_JAS, _2002_4_OND,
_2003_1_JFM, _2003_2_AMJ, _2003_3_JAS, _2003_4_OND, _2004_1_JFM,
_2004_2_AMJ, _2004_3_JAS, _2000_4_OND) # This is the pattern to remove

I am currently using this to remove the pattern: 
sub("(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)$", "", x,
perl=TRUE)


2) I am attempting to make graphs of the station_id_Timeseries (x) in
chronological order from 2000_4_OND to 2004_2_AMJ (there may be as as
few as 2 or as many as 16) versus the load_00600_W (y1) and the
load_00600_F (y2). There will be 2 plots for each x (x versus y1 & x
versus y2). The data used here comes from a .csv file where there are
about 100 sites and each site has it own unique station_id. In the end
there should be a .pdf plot for each site.


This is the full R code that I have written to process the data from the
.csv file in order to plot it:

trytablecompare <- read.csv("calibset_fluxmasterandWRTDS_20130226.csv",
sep = ",", stringsAsFactors = FALSE)
x = trytablecompare[-c(1:2, 2193:2196), 1]
sub("(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)$", "", x,
perl=TRUE)

columnsneed <- trytablecompare[-c(1:2, 2193:2196), c(1, 16, 18)]
sites <- columnsneed[1]

for(i in sites) {
pdf(paste0("output for ", sites,".pdf"))
xrange <- range("station_id_Timeseries:endofsubset$i")
yrange <- range("load_00600_W$endofsubset")
plot(x, y1, xlab="Year, Season", ylab="Total Flux (kg/season)")
lines(x, y1)
par(new=T)
xrange <- range("station_id_Timeseries:endofsubset$i")
yrange <- range("load_00600_F$endofsubset")
plot(x, y2, xlab="Year, Season", ylab="Total Flux (kg/season)")
lines(x, y2)
dev.off()
}


I have attempted to create reproducible code below, but I know that it
is not complete. 
For example:
x = c(02143500_2000_4_OND, 02143500_2001_1_JFM, 02143500_2001_2_AMJ,
02143500_2001_3_JAS, 02143500_2001_4_OND, 02143500_2002_1_JFM,
02143500_2002_2_AMJ, 02143500_2002_3_JAS, 02143500_2002_4_OND,
02143500_2003_1_JFM, 02143500_2003_2_AMJ, 02143500_2003_3_JAS,
02143500_2003_4_OND, 02143500_2004_1_JFM, 02143500_2004_2_AMJ,
02143500_2004_3_JAS, 21W43.5000_2000_4_OND, 21W43.5000_2001_1_JFM,
21W43.5000_2001_2_AMJ, 21W43.5000_2001_3_JAS, 21W43.5000_2001_4_OND,
21W43.5000_2002_1_JFM, 21W43.5000_2002_2_AMJ, 21W43.5000_2002_3_JAS,
21W43.5000_2002_4_OND, 21W43.5000_2003_1_JFM, 21W43.5000_2003_2_AMJ,
21W43.5000_2003_3_JAS, 21W43.5000_2003_4_OND, 21W43.5000_2004_1_JFM,
21W43.5000_2004_2_AMJ, 21W43.5000_2004_3_JAS) # station_id_Timeseries

y1 = c(rnorm(16), rnorm(16)) # load_00600_W
y2 = c(rnorm(16), rnorm(16)) # load_00600_F


for(i in x) {
pdf(paste0("output for ", sites,".pdf"))
xrange <- range("x1$i") # This would be the first set of sites for the
specified seasons
yrange <- range("y1") 
plot(x, y1, xlab="Year, Season", ylab="Total Flux (kg/season)")
lines(x, y1)
par(new=T)
xrange <- range(""x1$i"") # This would be the first set of sites for the
specified seasons
yrange <- range("y2")
plot(x, y2, xlab="Year, Season", ylab="Total Flux (kg/season)")
lines(x, y2))
dev.off()
}







Thank-you.

Irucka Embry



This is a small sampling of the data that I'm extracting to plot from
the .csv file:
station_id_Timeseries (as the x axis)
02143500_2000_4_OND
02143500_2001_1_JFM
02143500_2001_2_AMJ
02143500_2001_3_JAS
02143500_2001_4_OND
02143500_2002_1_JFM
02143500_2002_2_AMJ
02143500_2002_3_JAS
02143500_2002_4_OND
02143500_2003_1_JFM
02143500_2003_2_AMJ
02143500_2003_3_JAS
02143500_2003_4_OND
02143500_2004_1_JFM
02143500_2004_2_AMJ
02143500_2004_3_JAS
02169000_2000_4_OND
02169000_2001_1_JFM
02169000_2001_2_AMJ
02169000_2001_3_JAS
02169000_2001_4_OND
02169000_2002_1_JFM
02169000_2002_2_AMJ
02169000_2002_3_JAS
02169000_2002_4_OND
02169000_2003_1_JFM
02169000_2003_2_AMJ
02169000_2003_3_JAS
02169000_2003_4_OND
02169000_2004_1_JFM
02169000_2004_2_AMJ
02169000_2004_3_JAS
21GAEPD .01021001_2003_3_JAS
21GAEPD .01025001_2000_4_OND
21GAEPD .01025001_2001_1_JFM
21GAEPD .01025001_2001_2_AMJ
21GAEPD .01025001_2001_3_JAS
21GAEPD .01025001_2001_4_OND
21GAEPD .01025001_2002_1_JFM
21GAEPD .01025001_2002_2_AMJ
21GAEPD .01025001_2002_3_JAS
21GAEPD .01025001_2002_4_OND
21GAEPD .01025001_2003_1_JFM
21GAEPD .01025001_2003_2_AMJ
21GAEPD .01025001_2003_3_JAS
21NC02WQ.A2700000_2000_4_OND
21NC02WQ.A2700000_2001_1_JFM
21NC02WQ.A2700000_2001_2_AMJ
21NC02WQ.A2700000_2001_3_JAS
21NC02WQ.A2700000_2001_4_OND
21NC02WQ.A2700000_2002_1_JFM
21NC02WQ.A2700000_2002_2_AMJ
21NC02WQ.A2700000_2002_3_JAS
21NC02WQ.A2700000_2002_4_OND
21NC02WQ.A2700000_2003_1_JFM
21NC02WQ.A2700000_2003_2_AMJ
21NC02WQ.A2700000_2003_3_JAS
21NC02WQ.A2700000_2003_4_OND
21NC02WQ.A2700000_2004_1_JFM
21NC02WQ.A2700000_2004_2_AMJ
21NC02WQ.A2700000_2004_3_JAS
21NC02WQ.A4700000_2000_4_OND
21NC02WQ.A4700000_2001_1_JFM
21NC02WQ.A4700000_2001_2_AMJ
21NC02WQ.A4700000_2001_3_JAS
21NC02WQ.A4700000_2001_4_OND
21NC02WQ.A4700000_2002_1_JFM
21NC02WQ.A4700000_2002_2_AMJ
21NC02WQ.A4700000_2002_3_JAS
21NC02WQ.A4700000_2002_4_OND
21NC02WQ.A4700000_2003_1_JFM
21NC02WQ.A4700000_2003_2_AMJ
21NC02WQ.A4700000_2003_3_JAS
21NC02WQ.A4700000_2003_4_OND
21NC02WQ.A4700000_2004_1_JFM
21NC02WQ.A4700000_2004_2_AMJ
21NC02WQ.A4700000_2004_3_JAS
21NC02WQ.C0250000_2000_4_OND
21NC02WQ.C0250000_2001_1_JFM
21NC02WQ.C0250000_2001_2_AMJ
21NC02WQ.C0250000_2001_3_JAS
21NC02WQ.C0250000_2001_4_OND
21NC02WQ.C0250000_2002_1_JFM
21NC02WQ.C0250000_2002_2_AMJ
21NC02WQ.C0250000_2002_3_JAS
21NC02WQ.C0250000_2002_4_OND
21NC02WQ.C0250000_2003_1_JFM
21NC02WQ.C0250000_2003_2_AMJ
21NC02WQ.C0250000_2003_3_JAS
21NC02WQ.C0250000_2003_4_OND
21NC02WQ.C0250000_2004_1_JFM
21NC02WQ.C0250000_2004_2_AMJ
21NC02WQ.C0250000_2004_3_JAS
...

load_00600_W (one set of data for the y-axis)
2897.7904362491
7551.0945112213
4062.3936560196
4386.3935825817
2148.4803413963
5887.5158386817
4551.7100620272
5159.0706830313
10946.0644621646
20223.5133431946
14275.7834627695
16653.6617307993
13900.8965496484
13396.5350817754
10918.1025781657
37343.1840220667
61152.4563009734
3087159.69237187
83271.1072869206
78182.9098615795
10344.3815353876
2246.4450929669
989.220241325
2318.3488271707
24134.6766402373
34350.75952138
39041.6413152116
28188.925323908
2281.7849286464
1756.7094755792
357.3578073865
238.1185010405
182793.701052689
2338378.58622751
333158.050834378
135771.559284203
62988.8462340411
95409.5922031234
66045.2304429448
76782.5224502097
368902.001090301
717285.957906831
1189440.79489471
1077732.29658141
263564.368874354
372894.028862293
209856.865708756
250149.67080147
...



load_00600_F (one set of data for the y-axis)
4202.7437226
4202.7437226
16214.840538
7371.9290209
3114.1090754
2464.1114951
9380.6352081
3859.2809055
901.86146915
22377.413599
53563.26564
148264.35049
103538.36278
18142.045363
14672.031667
18796.93618
75313.330193
227675.73764
92777.682029
84827.680295
193298.65669
170799.05034
103666.8759
107485.71333
213765.87505
472307.65662
799500.99994
754868.43185
454078.02653
171521.77777
265827.90007
120401.25989
194000.26057
414312.49534
617213.70273
434832.6564
388556.44724
349308.46381
633838.70254
384887.09244
303766.12561
1065566.5203
2156874.9757
2521072.5523
1377743.9361
683078.62134
936362.89268
625201.60587
1094215.7135
... 


<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br>  <font color=#999999>Unlimited Email Storage &#150; POP3 &#150; Calendar &#150; SMS &#150; Translator &#150; Much More!</font></font></span>
	[[alternative HTML version deleted]]

