How can I create dummy variables from a factor in R? : <pre><code>Yield   Fertilizer
31  1
34  1
34  1
34  1
43  1
35  1
38  1
36  1
36  1
45  1
27  2
27  2
25  2
34  2
21  2
36  2
34  2
30  2
32  2
33  2
36  3
37  3
37  3
34  3
37  3
28  3
33  3
29  3
36  3
42  3
33  4
27  4
35  4
25  4
29  4
20  4
25  4
40  4
35  4
29  4
</code></pre>

<p>I have to divide fertilizer 1 as dummy variable F1, fertilizer 2 as a dummy variable F2 and fertilizer 3 as a dummy variable F3 and 4 as a base line.</p>

<p>I import this csv file into R by using read.csv function.
But after that when I just use lm function it does not come as I want...
What should I do for that?</p>
