3.19 Coding Questions
Run the following code to create the data that we will use in the problem
set.seed(1234) # setting the seed means that we will get the same results x <- rexp(100) # make 100 draws from an exponential distribution
Use the
ggplot2
package to plot a histogram ofx
.For this question, we’ll use the data
fertilizer_2000
. A scatter plot is a useful way to visualize 2-dimensional data. Use theggplot2
package to make a scatter plot with crop yield (avyield
) on the y-axis and fertilizer (avfert
) on the x-axis. Label the y-axis “Crop Yield” and the x-axis “Fertilizer”. Do you notice any pattern from the scatter plot?