R — Fall 21

R4 — RStudio & Histograms

By


This homework set is based on Lesson 4RStudio & Histograms. So you need to watch the video in Lesson 4 BEFORE you do this homework set.

 

I. Goals of this assignment:

1) Run R in RStudio

2) Create a histogram via the R command:

hist()

3) Understand the relationship between data skewedness and shape of histogram.

 

II. What to upload to Canvas for the R4 assigment?

Upload the following 2 items to Canvas by the due date and time:

      • RStudio screenshot (.pdf)
      • R script (.R)

 

Important: What the grader and I will do is to run your .R script on our computer to generate the boxplots. So make sure your .R script works!

The best way for you is to check if your script works or not is to do the following:

    • After you have uploaded your script to Canvas, log out of Canvas and then log back into Canvas. Download your .R script and run it on your R Console to see if it works!

 

III.  What to do for this assignment

  • Create one .R script to generate a left-skewed histogram (see details below)

AND

  • Take a screenshot of your RStudio windows and convert it to PDF

 

Here are the Details:

1) Come up with a quantitative variable that is different than the one shown in the video

      • Be creative! Don’t just copy my example.  Come up with something DIFFERENT than the example shown in the demonstration —  you will NOT receive full credit if your variable is TOO SIMILAR to mine — e.g. “monthly rainfall amount” or “annual rainfall amount” are TOO SIMILAR to my example!
      • Your variable can be biology-related (but they don’t have to be).
      • Label your variable clearly (e.g. calling your variable “school” or “season” is NOT clear enough)
      • Make up between 10 to 40 observations so that the histogram is roughly skewed to the left. Repeated data values (observations) are allowed.

 

2) Your histogram needs to satisfy the following:

      • the shape should be roughly skewed to the left
      • the histogram should have a minimum of 4 bars but no more than 12 bars
      • a chart title for the histogram
      • a label for the x-axis (include the unit of measurement)

 

3) At the top of your R script, use # to:

      • Type your name AND
      • Type a sentence or two to describe your quantitative variable.  Your variable can be biology-related (but they don’t have to be).  Just make sure that your variable makes sense and the labeling is specific enough.
      • It is optional to include other information such as assignment name, etc.

 

4) Take a screenshot of your RStudio windows and convert that screenshot to a PDF.

      • The screenshot PDF of your RStudio session should show all 4 windows
        • Script window showing your R commands
        • Console window showing certain commands being executed (it’s OK if your Console window shows errors).
        • Environment window showing your vector (object)
        • Plot window showing your histogram

 

5) Upload the following 2 items to Canvas by the due date and time.

        • RStudio screenshot (.pdf)
        • R script (.R)

No need to upload your histogram plot.

The video shows you how to save your histogram plot as a PDF because it is always necessary to do when for a research project or research article. However, for this assignment you DO NOT need to upload the histogram plot into Canvas.

-END-



Content is copyright the author. Layout is copyright Mark Ciotola. See Corsbook.com for further notices.