Module # 3 Data.frame
[CODE]
# Creating the data
Name <- c("Jeb", "Donald", "Ted", "Marco", "Carly", "Hillary", "Bernie")
ABC_poll_results <- c(4, 62, 51, 21, 2, 14, 15)
CBS_poll_results <- c(12, 75, 43, 19, 1, 21, 19)
# Creating a data frame
poll_data <- data.frame(Name, ABC_poll_results, CBS_poll_results)
# Displaying the data
poll_data
[OUTPUT]
Name ABC_poll_results CBS_poll_results
1 Jeb 4 12
2 Donald 62 75
3 Ted 51 43
4 Marco 21 19
5 Carly 2 1
6 Hillary 14 21
7 Bernie 15 19
CBS has a higher percentage of popularity for Bernie, Hillary, Donald, and Jeb.
As for ABC Ted, Marco, and Carly, all have higher percentages here compared to CBS.
Comments
Post a Comment