Saturday, 15 February 2014

graph - Graphing in R - combining factors -


This is a slightly awkward request, I do not know the function is in existence, but I was hoping there could be. Actually, I have a lot of variables that I'm looking for to give a result and therefore my normal data will look lower.

  Sample Delineline Exact line protein 1 LD LK 100 2 SD SR 150 3 LD LR200 4 SD SD 120 5 LD LK 95 6 SD SR 160 7 LD LR 1998 SDS 130 SF 130  

So I have 3 dependent variables (day length, exp, Line) and the result of 1 protein variable though, i have a gram What I would like to see in the comparison of protein levels is showing bars for L and S. experiments.

An example of the code that I want to draw once graph with ggplot2:

  ggplot (data = result, AES (x = day-length, y = protein, fill = row)) + geom_bar (stat = "identity", position = position_dodge ())  

And it will show me a graph to show results with lines offered for different series for LD and SD experiments. However, this does not account for my third factor, expt .

Usually in Excel I will be able to manipulate the table to give results for LD / L, LD / S. , SD / L and SD / S are going to separate headings and make a graph using them as X factor, but it can be difficult, especially if I want to rewrite the table, save it and Every time I'm going to run it in R. I was looking to see if there was a simple enough method either to group everything in order to manipulate the table in R as given below with some commands or to draw a graph each time directly, Especially, because in some cases I may be interested in combine two factors into the combination of various factors.

  Sample Dealment / Opt-Out Protein 1 LD / LK 100 2 SD / SR 150 3 LD / LR 200 4 SD / SK 120 5 LD / LK 95 6 SD / SR 160 7 LD / LR 1998 SD / SK 130  

You can use the interaction operator : on factors:

> built-in data using library (ggplot2) head (CO2) # plant type treatment conc. Fast # 1 Qn1 non-Quebec Quebec 95 16.0 # 2 Qn1 Quebec # Nonchil 175 30.4 # 3 qn1 CB EC nonchilled 250 34.8 # 4 Qn1 non-Quebec Quebec nonchilled QNQ QQ 371 QQ 371 QQ 371 QQ 152 QPH0635 Qplac 500 35.3 # (conc., Fast, color = type: treatment, data = CO2)

No comments:

Post a Comment