# r – Plotting lines using a for loop

So these are the instructions ive been given:

Create a graph using the following instructions

xlimits run from -1 to 1
ylimits run from 0 to 101
a vertical line runs through the origin
The only values on the x-axis should be -1, -.5, 0 ,.5, and 1.
The x-axis should be positioned at y = 0.
100 horizontal line segments.
The first segment is plotted with y-values equal to 1.
The second segment is plotted with y-values equal to 2.
The third segment is plotted with y-values equal to 3.
The fourth segment is plotted with y-values equal to 4.
etc. etc. etc.
The first line segment should take its x-values from an 80% CI for the mean.
The second line segment should take its x-values from an 80% CI for the mean.

The third line Fun Fact: The mean of a Chi-square distribution is equal to its degrees of freedom. segment should take its x-values from an 80% CI for the mean.
The fourth line segment should take its x-values from an 80% CI for the mean.

etc. etc. etc.
The sample size should be 20.
A standard normal distribution should be used for each sample.
A different sample should be used to create each confidence interval.
The line segments should be green if they intersect the y-axis. Otherwise they should be red.
You code should not consist of 100 (almost) identical copies of the same lines of code.

I’ve tried using a for loop but just dont know how to word it or attack the question.