I have a data with 4 variables that looks like:
id|name|year|value|
1 A 16 500
1 A 15 400
1 A 14 430
2 B 16 200
2 B 15 180
2 B 14 170
3 A 16 620
3 A 15 510
3 A 14 200
and then, I have to create in ggplot a temporal line chart for each id but showing up its label instead of its id. What I did was:
ggplot(db, aes(x=year, y= value)) + geom_line() + facet_wrap(~db$id)
but it shows the charts written their ids instead of their names, so I tried:
ggplot(db, aes(x=year, y= value)) + geom_line() + facet_wrap(~db$name)
It has created the line charts with their correct labels, however id 1 and id 3 have both the same name, so, at the end, it created only 2 charts instead of 3 with one of them with 6 observations instead of 3.
Is there a way to concatenate name with id? and then do by name corrected by the id concatenation.