Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Make sure to use R, and display the output and code for each Lab05 1) a) Read in

ID: 3370483 • Letter: M

Question

Make sure to use R, and display the output and code for each

Lab05 1) a) Read in data set "test.csv" into a data frame t. a. Note: test.csv doesn't have rownames. b) Display all the column names in t. c) How many rows do we have with longer than 5 years and PID higher than 9000? d) How many missing values dose column A have? e) Create a new variable "C" that is equal to the sum of column A and column B. Then attach the new column into t as the last column. f) Confirm your operation in step e) by displaying the dimension of new t data set. What is the mean of the column A, B, and C, respectively? g) Export the first 20 of the new data set from part f into a csv file called "new.csv". Make sure that you exclude the rows where A and B are BOTH missing and that all remaining missing values, if any, in "new.csv" show as "." and no row names show up as well

Explanation / Answer

#1.a.importing dataset
setwd("D:/")
t<- read.csv("data.csv", na.strings = "?")

#1.b. Display column names in t
colnames(t)

#1.c. Number of rows having longer than 5 years and PID higher than 500
nrow(t$years>5 & t$PID>500)

#1.d.number of missing values in colume A.
sum(is.na(t$A))


#SINCE THE DATASET IS NOT GIVEN THE OUTPUT CANNOT BE SEEN . TRY THIS CODES .HOPE THIS HELPS.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote