weights <- read.table('data') w1 <- weights[,1] w2 <- weights[,2] w3 <- weights[,3] w1 <- as.Date(w1, format="%m/%d/%Y") w2smooth <- smooth(w2, '3') png('weightRgraph.png', width=600, height=600) graphMax <- ceiling(max(w2)/5)*5 plot(w1, w2, xlab="date", ylab="weight", ylim=c(min(180, graphMax), graphMax)) points(w1, w2smooth, type='l', col='red') points(w1, filter(w2, rep(1,5))/5, type='l', col='darkblue') points(w1, seq(180, 180, length=length(w1)), type='l', col='green') dev.off() png('weightRgraphnogoal.png', width=600, height=600) plot(w1, w2, xlab="date", ylab="weight") points(w1, w2smooth, type='l', col='red') points(w1, filter(w2, rep(1,5))/5, type='l', col='darkblue') dev.off() png('bodyfatRgraph.png', width=600, height=600) plot(w1, w2*w3/100, xlab="date", ylab="body fat") points(w1, filter(w2*w3/100, rep(1,9))/9, type='l', col='darkblue') dev.off()