Creating and Analyzing Data Frames in R

Intro
In Module 3, I worked with data frames in R to organize and analyze polling data from a fictional 2016 presidential election dataset. The purpose of this exercise was to practice creating vectors, combining them into a data frame, and performing basic comparisons across variables using R.

The dataset consists of three variables:

  • Name – the candidate’s name

  • ABC – polling results from the ABC source

  • CBS – polling results from the CBS source

Each row in the data frame represents one candidate, and each column represents a variable. This structure makes it easy to compare values across different polling sources.

 

Results and Observations

After creating the data frame, I compared the results from ABC and CBS. Some candidates showed higher support in CBS polls, while others performed better in ABC polls. This highlights how different polling sources can produce varying results even when measuring the same data.

I also added calculated columns to examine the difference between the two sources and the average support for each candidate. This made it easier to rank candidates and observe overall trends.

Reflection

This module helped me better understand how data frames work in R and why they are one of the most important data structures for data analysis. Organizing data in a tabular format allows for easier comparisons, calculations, and interpretation of results. I feel more comfortable creating and modifying data frames after completing this assignment.

Conclusion

Overall, this assignment reinforced the importance of structured data and basic data manipulation in R. Learning how to create and analyze data frames will be useful in future statistical and data science projects.

Comments

Popular posts from this blog

Module 5: Determinant and Inverse of Matrices in R

Module 10: Friedman R Package Proposal