Obtaining mean from data frame and matrix
This is an explanation about the conversion of given values of data into data frame and matrix and obtaining mean from them. Name of the candidates outlined in the data frame is Jeb, Donald, Ted, Marco, Carly, Hillary and Bernie. Sources of the polls here are ABC and CBS. Data of the names and political results of both polls are added to the environment. > 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) By applying ‘cbind’ to the values, merged data with all three columns of the values into data 'poll_results' is obtained. > poll_results<-cbind(Name,ABC_political_poll_results,CBS_political_poll_results) > poll_results Name ABC_political_poll_results CBS_political_poll_results [1,] "Jeb" "4" ...