filelist <- list.files(pattern = "\\.heights")
df <- data.frame(person = character(),
dates = character(),
height = numeric())
for (fname in filelist){
x <- read.table(fname, sep="", as.is = TRUE)
person <- gsub("\\.heights", "", fname)
names(x) <- c("dates", "height")
df <- rbind(df, data.frame(person = rep(person, times = nrow(x)),
dates = x$dates,
height = x$height))
}
df$dates <- strptime(as.character(df$dates), "%d/%m/%Y")
df$dates <- as.POSIXct(df$dates)
require(ggplot2)
pdf("Heights.pdf")
qplot(dates, height, data = df, color = person)
dev.off()
pdf("Heights_2.pdf")
plot(df$dates, df$height, col = as.numeric(df$person))
dev.off()