I have a group of people, with a space-separated text file for each person. In these files, the right value indicates the height of that person in cm
and the left value indicates the date in %d/%m/%Y
format:
09/05/1992 0
17/03/1993 50
02/08/1994 65.5
03/12/1995 72
A height of 0
marks the birth date of the person.
This R script draws a graph of the heights of John and Amy and outputs it to a PDF:
pdf("Heights.pdf")
john <- read.table("John",sep="")
names(john) <- c("time","height")
jt <- strptime(john$time, "%d/%m/%Y")
jh <- john$height
amy <- read.table("Amy",sep="")
names(amy) <- c("time","height")
at <- strptime(amy$time, "%d/%m/%Y")
ah <- amy$height
plot(jt,jh,type="b",pch=20,col="red",
xlab="Date",ylab="Height",
ylim=c(min(jh,ah),max(jh,ah)))
points(at,ah,type="b",pch=20,col="green")
title("Heights")
How can I extend this script to:
- Graph all files in the current directory ending with
.heights
? - Make the graph relative to each person's birth date?