Lab Assignment 1: Introduction to R
Part 1: R
Create a variable called
myageand assign it the value of your age.Create a vector called
gradescontaining the following values: 88, 92, 75, 99, and 80.Using indexing, print the third element of the
gradesvector to the console.Use the function
mean()to calculate the average grade. Assign the result to the objectavg.Create a data frame called
student_infocontaining the following columns: Name, Age, Major, Absent. The data should be as follows:
| Name | Age | Major | Absent |
|---|---|---|---|
| John | 20 | AgBiz | TRUE |
| Emily | 22 | ENRE | TRUE |
| Michael | 19 | ENRE | FALSE |
| Jessica | 21 | AgBiz | FALSE |
Install the package
tidyverse. It installs many packages that we will use throughout the course. It may take some time. If things are happening in the console, it is working.Write a brief explanation of what you did in steps 1-6 and how it relates to the tutorial we did in class.
Part 2: Getting Started with VS Code
Ask AI (github copilot in VS Code) to complete part 1 steps 1-6. Write a brief reflection addressing the following questions:
- How does the code that copilot wrote compare to your approach?
- If it answered the questions differently, ask copilot to explain why?
How to Submit
You will submit two documents: the .log file for part 1 and a word doc or text file with your reflection. Refer to the lab instructions on generating a log file. Submit the two files on Canvas.