Thanks for replying folks.
It's hard to make a runable example. I'm new to R and have hacked together some code (600 lines) to process this data, learning as I go. I'm now trying to fill gaps in my knowledge before rewriting the code from scratch in a more structured and efficient way.
What led me to this question was scale_color_manualwhich can be used as part of a ggplot structure to define labels and colours for the data series in a chart.
# This can be done by declaring the values in place
scale_color_manual(labels =c("England", "Northern Ireland", "Scotland", "Wales"), values = c( "blue3", "green3", "purple3","grey50")) +
# or by creating named lists once and reusing them as needed
lset_4Nations = c("England", "Northern Ireland", "Scotland", "Wales")
cset_x4n = c( "blue3", "green3", "purple3","grey50")
# Then this is much tidier
scale_color_manual(labels = lset_4Nations, values = cset_x4n ) +
I expected there would be similar ability for labeller blocks but can't find the information on line.
The issue isn't where the data comes from for the labeller. It is the ability to combine the two lists to avoid having to generate them explicitly as in the example above, copied here.
sc_labels <- as_labeller(c(
`data_1` = "Data Field 1",
`data_2` = "Data Field 2",
`data_3` = "Data Field 3",
`data_4` = "Data Field 4" ))
This might need to wait until I've done the rewrite and I can try to pull out an example as I go.
All the best
Michael