Classwork 7

Data Transformation with R - select() and rename()

Author

Byeong-Hak Choe

Published

October 5, 2026

NoteNote

Please complete the question in this Classwork, and submit your response in the corresponding Brightspace page.

Consider the following data.frame, nyc_payroll_new.

library(tidyverse)
nyc_payroll_new <- read_csv("https://bcdanl.github.io/data/nyc_payroll_2025.csv")


For detailed descriptions of the variables in this data.frame, please refer to the following link:


Question 1

Create a new data.frame, df that keeps only the following five variables—Fiscal_Year, Agency_Name, First_Name, Last_Name, and Base_Salary—from the data.frame nyc_payroll_new.

Answer:



Question 2

Given the data.frame df with a variable named Agency_Name, how would you rename it to Agency?

Answer:



Question 3

How would you remove the Fiscal_Year variable using select()?

Answer:



Back to top