Plot data in a group where the groups are in another data.frame

0

I have this data.frame

      date   pol  S01P01    S01P02    S01P03    S01P04    S01P05    S01P06
1 2016-01-23  vh -11.89972 -10.32407 -11.56241 -11.54153 -11.76252 -12.49887
2 2016-10-01  vh -11.98468 -10.65089 -12.51395 -11.72623 -13.15072 -12.06073
3 2016-10-13  vh -11.65762 -10.63290 -12.22330 -11.71028 -11.42347 -11.28547
4 2016-10-25  vh -12.04775 -10.70859 -11.99464 -11.21668 -11.71940 -11.73433
5 2016-11-06  vh -12.46716 -10.83744 -12.27083 -11.40012 -11.58011 -12.07295
6 2016-11-18  vh -12.32682 -11.34631 -12.96969 -11.45849 -10.61518 -12.68052

I used the code below to plot each S?P? according to date and with different rows to pol. It worked fine and generated a graph for each of the 237 variables S?P?

for(i in 3:239){
ggplot(bm,aes(x = date, y = bm[1:66,i], colour = pol)) + geom_line()+ 
  theme_bw()+
  theme(axis.title = element_text(size = "14"), axis.text = element_text(size = "11"))+
   scale_color_manual(labels = c("VH","VV"), values = c("green", "blue"))

I would like to make the same graphics but with the S?P? variables grouped together. I have these groups in another data.frame

      x   sumbio     densid   nm2  group
1 S01P06 5.568933        40 0.0640  n1b1
2 S01P10 8.698105        48 0.0768  n1b4
3 S01P20 9.724722        57 0.0912  n1b3
4 S02P01 4.151170        42 0.0672  n2b1
5 S02P04 8.692647        59 0.0944  n1b1
6 S02P14 9.162235        49 0.0784  n1b2

Would anyone know how to help me?

    
asked by anonymous 23.11.2017 / 16:06

0 answers