Module # 8 Input/Output, string manipulation and plyr package

 In this assignment, I worked with a student dataset in R and practiced importing data, calculating summary statistics, filtering observations, and exporting results to files. These steps helped reinforce basic data manipulation techniques that are commonly used in data analysis.

First, I imported the dataset into R using the read.table() function and loaded several required packages, including plyr. After the dataset was loaded, I used the ddply() function from the plyr package to group the data by Sex and calculate the mean grade for each category. This allowed me to quickly compare the average grades between the groups. After calculating these results, I wrote the output to a file so it could be saved and used outside of R.

Next, I created a filtered version of the dataset that only included students whose names contained the letter “i.” To do this, I used the subset() function combined with grepl() to search for the letter within the Name column. This created a smaller dataset containing only the relevant students.

Finally, I exported the filtered dataset to a CSV file using the write.csv() function. Saving the data in CSV format makes it easy to open in programs like Excel or share with others.

Overall, this assignment demonstrated how R can be used to import datasets, perform grouped calculations, filter specific records, and export results for further use. These are fundamental skills that are important for real-world data analysis workflows.

Comments

Popular posts from this blog

ABC vs. CBS: Comparing Fictional Presidential Poll Data in R

Assignment #10: Building Your Own R Package

Module # 4 Programming structure assignment