Welcome to homework 1! Before we get started, there are some quick things I would like to draw your attention to. First, to use this template, you will need to make sure you have already installed all R packages that are listed in the ‘master package R script,’ and also load-in the necessary packages below. Once packages are installed, please see below for how the structure of these homework assignments/files will be arranged!

All RMarkdown homework assignments will be structured in the same way! Please do not mess with the start of the templates! These are all set up a specific way for a reason!


Load in Packages


Always start by loading in your various libraries. It is good practice to load all the packages in at the same time. This allows you to know exactly what is needed to reproduce your analyses. For this assignment, we will be working with the ‘psych’ package, but we will also need the other below packages to ensure our RMarkdown HTML file gets ‘knitted’ correctly!

Load in Data (download the “School1.csv” file from Canvas)


For this assignment, this technically will be worth 1 point and is question #1. However, future assignments will require you to import data either via code or through the ‘import dataset’ point and click option and will not be worth points.

Homework Questions (10 points total)


1. Import the raw dataset (“School1.csv”) into R using either syntax or the import dataset option discussed in lab. If you use the import dataset option, leave a comment that says you did. Make sure the name of the R dataset is “School1”. (1pt)

2. Check and call your working directory (.5pts)

3. Call the dataset to verify that the data are being properly read (.5pts).

4. Describe the variable “ACT” in the dataset using the ‘describe’ function in the psych package (1pt).

5. Describe the variable “HSGPA” in the dataset by “Gender” also using the psych package (1pt).

6. Change the level of “Gender” to a factor and give the levels of the factor names in the dataset. (1 = male; 2 = female) (2pts).

7. Run a basic frequency analysis of the variable “College.” Which school had the most people? (1pt)

8. Plot the “Race” variable using the base R ‘plot’ function (1pt).

9. Produce a scatterplot between ACT (x axis) and HSGPA (y axis). Make sure to include labels for the x and y axis, plot title, and a fit line (2pts).

Reminders:


You can write your responses directly into the Rmarkdown document, along with your code.

  • Code will go in the ‘gray boxes,’ whereas your interpretation or answer to the question should come after!!
    • You will need to turn in both the ‘Rmarkdown’ HTML file, as well as the specific Rmarkdown base file that ends in ‘.Rmd’ (both should be saved to your working directory).



Start Actual Coding Below!!!

Question 1: import data (this should have been done already - if you imported the dataset using the ‘point and click’ option, leave a comment)




Question 2: Call your working directory




Question 3: Call the dataset to verify that the data are being properly read




Question 4: Describe the variable “ACT” using the ‘describe’ function in the psych package




Question 5: Describe the variable “HSGPA” in the dataset by “Gender” (also in psych)




Question 6: Change the level of “Gender” to a factor and give the levels of the factor names in the dataset (1 = male; 2 = female)




Question 7: Run a basic frequency analysis of the variable “College.” Which school had the most people?



Which school had the most people? (Type your answer anywhere below)




Question 8: Plot the “Race” variable using the base R ‘plot’ function




Question 9: Produce a scatterplot between ACT (x axis) and HSGPA (y axis). Make sure to include labels for the x and y axis, and title, and a fit line

Congrats, you’ve survived!

I recommend ‘knitting’ your RMarkdown file before saving it, as this will automatically save the file for you anyways, and also ensure your RMarkdown HTML file is the most up to date. Again, don’t forget to upload BOTH the .html and .Rmd files in Canvas before midnight next Wednesday!

 




A work by Your Name Here