if (FALSE) {
## load the Growth dataset
dataf = dataf.growth()
labels = unlist(dataf$labels)
plot(dataf,
main = paste("Growth: girls red (", sum(labels == "girl"), "),",
" boys blue (", sum(labels == "boy"), ")", sep=""),
xlab="Year", ylab="Height, cm",
colors = c("blue", "red") # in alphabetical order of class labels
)
# plot an observation as a line
observation = structure(list(dataf = list(dataf$dataf[[1]])), class = "functional")
lines(observation, colors = "green", lwd = 3)
# plot hight at the age of 14
indexAge14 = which(observation$dataf[[1]]$args == 14)
hightAge14 = observation$dataf[[1]]$vals[indexAge14]
atAge14 = structure(list(
dataf = list(dataf = list(args = 14, vals = hightAge14))
), class = "functional")
points(atAge14, colors = "yellow", pch = 18)
}
Run the code above in your browser using DataLab