# 8-5 Exercise 2 # Use the Results data from previous exercises # The data is held in a file called Results.csv # This is within the SP08 folder of the current working directory # The file contains headers # Load file results<-read.csv("SP08/Results.csv", header=TRUE) # Display results results # Remove all rows that contain NA data results<-results[complete.cases(results),] # Display results results # Create a column to calculate the overall grade newcol<-(0.3*results$CW1)+(0.35*results$CW2)+(0.35*results$Exam) # Bind the new column to the data frame results<-cbind(results,Overall=newcol) # Display results results # Create a column to show whother Overall is greater than 40 pass<-results$Overall>=40 # Display pass pass # Bind the new column to the data frame results<-cbind(results,Pass=pass) # Display results results # Extract the fails into a dataframe resits resits<-results[results$Pass==FALSE,] # Display resits resits