Write a ggtitle & facet_wrap based on variable

I managed to plot the dataframes that are contained in a list I created like this

    for (i in seq_along(df)){   
  plots <- lapply(listL, function(x)
    ggplot(x, aes(x, y)) + 
      geom_jitter(...) + 
      geom_smooth(...) +
      ...
      ggtitle(title))
}

I made one separate data-frame for overview that looks like this, the plots are not based on this df.

overviewdf.
Variable1 Year   Name  Variable2
1 xxxx    1000 Name1   a   
2 xxxx    1001 Name1   b
3 xxxx    1002 Name1   a
4 xxxx    1003 Name2   b
5 xxxx    1004 Name2   b
6 xxxx    1004 Name2   b
7 xxxx    1005 Name2   a
8 xxxx    1006 Name3   a

Is there any way I can include the year, and the name linked to it, to the plot title? How do I facet_wrap plots according to the names they're linked with?

Thank you for your help!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers.

It really is very hard to reverse-engineer the problem, and most people who might be able to provide answers might not take the trouble

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.