Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2012/03/19

Request for Assistance: R Graphing Script for my QS project

Here is the R source for my QS weight graph. I get the data in Perl, run it through Template Toolkit, and run it out through here.
# R file template in Template-Toolkit
w_avg <- c( [% weight_average %] )
date <- c( [% dates %] )
w_count <- c( [% measurement_count %] )
weight <- c( [% weight %] )
png(
filename="data.png" ,
width = 600 ,
height = 400 ,
pointsize = 12
)
plot (
weight ,
col="red" ,
name="Weight Record - [% name %]" ,
type="o" ,
xlab="time" ,
ylab="weight in lbs"
)
lines(
w_avg ,
col="blue",
type="o"
)
dev.off()
view raw data.R hosted with ❤ by GitHub
It is my code. I like my code. But I know it could be better, even without doing the database query in the R, which I believe it can do.

Here are the things I want to be able to do:

  • I should have dates corresponding to the points. I have the data. I should put them in.
  • Because I take measurements in the morning when I get myself together, I do not always remember to weigh or upload my weight. I want the graph to show this.
  • I also know how many data points are averaged to make the red line. I want to overlay that over the graph, to show the quality of each rolling average point.
Suggestions and patches are accepted. I should say I want to do this with ggplot2 with Cairo as the image library, so I don't have to rely on X11 for rendering and can crontab this.

No comments:

Post a Comment