1

example

Hello,

I am trying to analyze a dataset where the response variable has two different classes X and Y and each class has three categories as High, medium and low:

Treatment High_X Medium_X Low_X
N1 6.45 2.61 NA
N1 9.43 2.82 NA
N2 7.2 2.92 1.9
N2 3.67 3.29 2.94
N3 2.72 2.4 1.36
N3 3.51 4.3 1.99
N4 9.76 2.91 2.35
N4 6.72 3.42 6.04
N5 7.28 4.1 1.78
N5 5.09 4.38 NA

Treatment High_Y Medium_Y Low_Y
N1 4.45 6.1 2.9
N1 6.23 8.2 1.8
N2 4.2 2.2 NA
N2 2.7 3.9 NA
N3 5.2 4.0 3.6
N3 5.1 4.3 2.9
N4 7.6 NA 3.5
N4 7.2 NA 1.4
N5 2.8 3.1 1.8
N5 5.9 3.8 NA

I have not any such plot before and need any suggestions to work on it. I have a put example output picture above where I want High, medium and low categories on x-axis; and two lines each for X and Y representing each category. Thank you for the help!

Jessica
  • 391
  • 1
  • 3
  • 16
  • 2
    What do you want to do with the "Treatment" variable here? Do you currently have two separate data.frames? It's better if you share your data in a [reproducible format](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can copy/paste into R. Do you still want a line plot when you have a categorical x axis? That seems potentially odd. I'm not exactly sure what the desired output should look like here. – MrFlick Feb 04 '20 at 21:51
  • Thank you! I think I got confused. I want to represent treatments with the classes X and Y. Yes, I have two separate data frames but I want to make a plot with both together. I think Treatment can be represented on X axis but I also want to categorize it. I am not sure if line plot or the bar plot will be a better option. – Jessica Feb 04 '20 at 21:59
  • 2
    If you don't know exactly what you want your plot to look like, then this isn't a programming question just yet. General questions about data visualization aren't really on-topic on Stack Overflow though they are on-topic for [stats.se]. If we don't know exactly what you want it's hard to write code to do it. – MrFlick Feb 04 '20 at 22:01
  • I think I still want a line graph with treatments on X axis. And lines reprinted by classes X and Y. I want to drop the categories high, medium and low. I want to have one response variable by adding all the categories for each treatment. I hope I made it clear this time. If not, I can trying posting it in Cross Validated. Thank you! – Jessica Feb 04 '20 at 22:12

0 Answers0