Module # 3 data.frame

 


Module # 3 data.frame

> Name <- c("Jeb", “Donald”, "Ted”, “Marco” “Carly”, “Hillary”, “Berine”)

> ABC political poll results <- c(4, 62 51, 21, 2, 14, 15)

> CBS political poll results <- c(12, 75, 43, 19, 1, 21, 19) 

This dataset compares polling results from two different sources, ABC and CBS, for several presidential candidates during the 2016 election. Although the data is fictional for this assignment, it demonstrates how different polling organizations may report varying levels of support for the same candidates.

Overall, CBS tends to report higher poll numbers than ABC for most candidates, particularly for Donald and Hillary. Some candidates, such as Carly, show consistently low support across both polls, while others like Ted show notable differences between the two sources.

These differences highlight how polling results can vary depending on methodology, sample size, or reporting source. In this blog I used RStudio to organize and analyze the data makes it easier to identify trends and compare results across multiple examples below.

Also, this analysis reflects concepts from Chapters 3–5 of The Art of R Programming, particularly the use of vectors and data frames to structure data and perform comparisons efficiently.


This code makes a table





The code shoes which candidate had higher support in CBS vs ABC
(The largest disagreement between polls is for Donald, where CBS shows 13 points more support than ABC.)






This code shows the summary
(Overall, CBS tends to report higher poll numbers than ABC, both on average and at the high end.)






Conclusion:

The results show that CBS generally reports higher levels of support than ABC, with a higher mean (27.14 vs. 24.14) and median (19 vs. 15). The largest discrepancy occurs for Donald, where CBS reports 13 points more support than ABC. However, some candidates such as Ted and Marco show higher support in the ABC poll, demonstrating that polling results can vary depending on the source.

Again, though the data is fictional, this example illustrates how different polling organizations may produce different outcomes and how R can be used to efficiently organize, summarize, and compare data.











Comments

Popular posts from this blog

Module # 6 Doing math in R part 2