For this assignment, I imported a data set into R. I converted this dataset into a dataframe with only students whose name contains the letter 'i'. Finally, I converted the data to a csv file. Here is my code: file_path <- "C:/Users/elisa_pazp940/Downloads/Assignment 6 Dataset.txt" data <- read.table(file_path, header = TRUE, sep = ",") install.packages('plyr') library(plyr) sex = data$Sex mean(sex) y = ddply(data, "Sex", transform, Grade.Average=mean(Grade)) y write.table(y, "Sorted_Average") write.table(y, "Sorted_Average", sep=",") newdata = subset(data, grepl("[iI]", data$Name)) write.table(newdata, "DataSubset", sep = ",") newdata
Comments
Post a Comment