This file contains a set of tasks that you need to complete in R for the lab assignment. The tasks may require you to add a code chuck, type code into a chunk, and/or execute code. Some tasks may also ask you to answer specific questions. Don’t forget that you need to acknowledge if you used any resources beyond class materials or got help to complete the assignment.
More information and examples that can help you with this assignment can be found in the file “GettingtoKnowYourDataTutorial.html”.
The data set you will use is different than the one used in the instructions. Pay attention to the differences in the Excel file name and any variable names. You will need to adjust your code accordingly.
Once you have completed the assignment, you will need to publish it to produce an html file. You will then need to upload the html file and this .Rmd file to AsULearn.
The first thing you need to do in this file is to add your name and date in the lines underneath this document’s title (see the code in lines 10 and 11). While you will change the things in lines 10 and 11, you should not add anything new in this file until after line 42. Do not delete anything in the file.
You need to identify and set your working directory, load packages,
and load your data in this section. In addition to the
openxlsx package that we used in the Getting Started in R
lab, you also need to load the packages dplyr and
tidyverse. Remember that before you load a package for the
1st time, you need to install the package. The name of the Excel file is
different than what is in the instructions, you will need to adjust the
code to read in the Excel file that was downloaded as part of the zip
file.
Insert your chunks of code here to identify and set your working directory, load packages, and load the data. I recommend doing one thing per chunk of code.
If you are working in title: “PS3115 Fall2025 Getting to Know Your Data” the cloud version of RStudio, you do not need to set the working directory because you will have had to load this file and the Excel file into the cloud to be able to access them. Instead right before your chunk of code write in all capital letters that you are using RStudio in the cloud.
Display the first 15 observations of your data set.
Insert your chunk of code here to display your first 15 observations.
Add a variable that is a unique id for each observation. Then take another look at the data. After creating the unique id variable, display the first 15 observations in your data set.
Insert your chunk of code here to create your unique id and then display your data.
In this section you need to covert variables into the numerical
format and clean up any messy observations. The numerical variables you
need address in this section are: Age,
MinutesDirving, SandwichPrice,
DinnerPlatePrice, and RibsPrice.
You know the following things about your data that will be helpful when conducting your recodes. First, all the respondents should be between the ages of 18 and 90. Second, no respondent is willing to drive more than 100 miles for BBQ. Third, it is unreasonable that the price of a sandwich is less than $5, the price of a dinner plate less than $15, or the price of ribs is less than $20. Fourth, no one should be willing to pay more than $50 dollars for a sandwich, dinner, or ribs.
After you have reformatted the variables and done the necessary recodes, use the print command to compare the original variables to your new variables.
Remember > means greater than and < means less than.
Insert your code here for recoding and cleaning numerical variables. I recommend doing one thing per chunk of code.
In this section you need to recode categorical variables to assign
values to their different categories. The following are the categorical
variables in the data set: Sex, FavoriteMeat,
FavoriteSauce, FavoriteSide.
You should reference the code book for the BBQ data set to know the numerical values to assign to the different categories.
After you have completed recoding the variables, use the print command to compare the original variables to your new variables. Don’t forget capitalization matters.
Insert your code here for recoding and cleaning categorical variables. I recommend doing one thing per chunk of code.
Nobody helped me
I did not help anyone
Click the “Knit” button to publish your work as an html document. This document or file will appear in the folder specified by your working directory. You will need to upload both this RMarkdown file and the html file it produces to AsU Learn to get all of the lab points for this week