Making a line graph in R with multiple treatments?
<p>sorry for the multiple questions about R. I'm new and still learning! So I am currently trying to make a multiple-line line graph with my data. I have 3 treatment groups with 4 individuals each. I am planning on factoring those into 3 groups for R. First, I want to make sure my data is set up in such a way in excel that i could make this graph. Second, how would I go about doing this? Is ggplot the best tool or is there another package that could be utilized? </p>

<p>I would like to have my X-axis as the dates (these are <code>10.15.2015</code>for eg.), my Y-axis as the weights, and my 3 treatment groups, Lean, AdLib, and HF, as the data lines. As I said above, I used <code>datum$Group= factor(Datum$Group)</code> to group the <code>Pig</code> individuals into their 3 treatment groups. </p>

<p>I have looked at other questions on here but it did not seem like they were what I wanted.</p>

<p>Here is my data: </p>

<pre><code>dput(datum)
structure(list(X10.5.15 = c(56L, 54L, 61L, 39L, 52L, 66L, 48L, 
49L, 59L, 55L, 37L, 59L), X10.26.15 = c(76L, 70L, 72L, 61L, 79L, 
93L, 72L, 72L, 84L, 71L, 50L, 85L), X11.3.15 = c(82L, 76L, 88L, 
67L, 90L, 102L, 83L, 83L, 100L, 96L, 56L, 100L), X11.10.15 = c(87L, 
84L, 93L, 71L, 99L, 110L, 93L, 93L, 109L, 107L, 65L, 112L), X11.17.15 = c(93L, 
90L, 100L, 77L, 106L, 116L, 101L, 100L, 121L, 122L, 71L, 119L
), X11.24.15 = c(102L, 99L, 109L, 86L, 113L, 124L, 107L, 108L, 
128L, 128L, 80L, 122L), X12.3.15 = c(114L, 113L, 123L, 100L, 
118L, 132L, 122L, 118L, 143L, 142L, 91L, 137L), X12.10.15 = c(117L, 
117L, 125L, 106L, 134L, 141L, 130L, 126L, 152L, 151L, 98L, 148L
), X12.17.15 = c(125L, 122L, 134L, 112L, 150L, 154L, 135L, 134L, 
162L, 162L, 106L, 160L), X12.22.15 = c(128L, 127L, 135L, 114L, 
156L, 161L, 141L, 140L, 166L, 176L, 109L, 166L), X12.29.15 = c(135L, 
130L, 142L, 119L, 155L, 164L, 149L, 149L, 174L, 195L, 121L, 176L
), X1.5.16 = c(138L, 135L, 150L, 129L, 167L, 172L, 163L, 154L, 
185L, 205L, 128L, 182L), X1.12.16 = c(154L, 157L, 166L, 146L, 
180L, 188L, 173L, 163L, 200L, 208L, 140L, 188L), X1.19.16 = c(148L, 
151L, 165L, 141L, 180L, 182L, 171L, 176L, 211L, 219L, 149L, 197L
), X1.26.16 = c(154L, 151L, 171L, 148L, 192L, 196L, 181L, 179L, 
212L, 230L, 156L, 205L), X2.2.16 = c(162L, 162L, 179L, 154L, 
200L, 200L, 191L, 184L, 228L, 228L, 162L, 225L), X2.9.16 = c(172L, 
169L, 187L, 164L, 203L, 202L, 188L, 194L, 237L, 253L, 168L, 234L
), X2.16.16 = c(173L, 167L, 192L, 162L, 211L, 215L, 199L, 202L, 
233L, 258L, 173L, 238L), X2.23.16 = c(185L, 174L, 202L, 172L, 
220L, 218L, 208L, 204L, 253L, 254L, 185L, 239L), X2.29.16 = c(183L, 
169L, 202L, 166L, 216L, 220L, 204L, 206L, 256L, 269L, 187L, 252L
), Pig = c(102L, 105L, 108L, 204L, 101L, 104L, 106L, 602L, 103L, 
107L, 205L, 603L), Group = structure(c(3L, 3L, 3L, 3L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L), .Label = c("AdLib", "HF", "Lean"), class = "factor")), .Names = c("X10.5.15", 
"X10.26.15", "X11.3.15", "X11.10.15", "X11.17.15", "X11.24.15", 
"X12.3.15", "X12.10.15", "X12.17.15", "X12.22.15", "X12.29.15", 
"X1.5.16", "X1.12.16", "X1.19.16", "X1.26.16", "X2.2.16", "X2.9.16", 
"X2.16.16", "X2.23.16", "X2.29.16", "Pig", "Group"), row.names = c(NA, 
-12L), class = "data.frame")
</code></pre>

<p>Thanks for your help in advance!</p>