# Bopbun R course chapter 3. Original simulated example.
# Bob, 2026-11-27. CC0-1.0.
seedlings <- data.frame(
  seedling = c("A", "B", "C", "D", "E", "F"),
  height_cm = c(8, 11, 9, 14, 12, 18)
)
print(seedlings)

nrow(seedlings)
ncol(seedlings)
names(seedlings)

seedlings$height_cm
mean(seedlings$height_cm)

seedlings[3, ]
seedlings[3, "height_cm"]

barplot(seedlings$height_cm,
        names.arg = seedlings$seedling,
        col = "#0066CC", border = NA, ylim = c(0, 20),
        xlab = "Seedling", ylab = "Height (cm)",
        main = "Heights from a data frame")

practice <- seedlings[c(2, 5), ]
print(practice)
sum(practice$height_cm)
mean(practice$height_cm)
