I have a large dataset that I'd like to use to plot genetic divergence along chromosomes. The data frame I am using has the following format.
ID Group 100 270 310 430 460 550 580 660 710 740
Strain1 A 0.191 0.147 0.124 0.149 0.193 0.189 0.123 0.189 0.151 0.180
Strain2 A 0.188 0.188 0.149 0.136 0.000 0.199 0.199 0.188 0.149 0.000
Strain3 B 0.123 0.147 0.190 0.061 0.148 0.149 0.148 0.197 0.178 0.172
Strain4 B 0.147 0.197 0.188 0.178 0.179 0.149 0.191 0.154 0.179 0.187
I'd like to use ggplot2 to plot a line for each strain, with the lines colored according to group affiliation, and a continuous x-axis running from chromosome positions 100 through 740. I cannot figure out how to melt the data without extracting the group info first and then adding it back after melting. Can anyone suggest a one-step approach to accomplish this?