I\'d like to plot multiple lines in R for this dataset: (x = Year, y = Value)
School_ID Year Value
A 1998 5
B 1998 10
C
Is this what you want? You need group = School_id to tell ggplot2 to plot separate lines for each school. If you want the horizontal axis to incluude all years between 1998 and 2005, then remove factor in x = factor(year)
library(ggplot2)
df = read.table(text = "School_id Year Value
A 1998 5
B 1998 10
C 1999 15
A 2000 7
B 2005 15", sep = "", header = TRUE)
ggplot(data = df, aes(x = factor(Year), y = Value, color = School_id)) +
geom_line(aes(group = School_id)) + geom_point()