##load the required bits library(RODBC) library(lattice) ##set up the connection channel<-odbcConnect("mike_db", uid="mike") ##sqlTables(channel) ##a<-sqlFetch(channel,"AnE") ##b<-sqlFetch(channel,"vwAnE") ##b<-sqlQuery(channel, paste("select * from vwAnE order by loc, month_val")) ##xyplot(N~month_val|LOC,b, type="l") ##c<-sqlQuery(channel, paste("select CM,sum(numerator)" ## ,"from EP_2010_2011_ENHANCED"# ## , "WHERE not parnt like 'z_%' " ## ," group by CM" ## )) ##execute a query for the data e<-sqlQuery(channel, paste("select CM,aggregate_02,spect,Numerator,denominator,value,target, year_month+'-01' as year_month" ,"from EP_2010_2011_ENHANCED" ,"where 1=1 and CM like '%e_01%'and TIME_TYPE='per-month'" ,"and parnt like 'z_t%'order by aggregate_02,spect,year_month")) ##convert the year_month value to a date e$year_month<-as.Date(e$year_month) ##plot the lattice xyplot(value~year_month|spect,e, type="l", cex=3) xyplot(value+target~year_month|spect,e, type="l", size=5)
sql access part 2 with boxplot and big query
Reply