Posts

Showing posts from January, 2023

Assignment 3

Image
 Name <- c("Jeb", "Donald", "Ted", "Marco", "Carly", "Hillary", "Berine") ABC_politicalpollresults <- c(4, 62, 51, 21, 2, 14, 15) NBC_politicalpollresults <- c(12, 75, 43, 19, 1, 21, 19) results <- cbind(Name, ABC_politicalpollresults, NBC_politicalpollresults) results results.df <- data.frame(Name,  ABC_politicalpollresults, NBC_politicalpollresults) results.df mean(ABC_politicalpollresults) mean(NBC_politicalpollresults) mean(ABC_politicalpollresults + NBC_politicalpollresults)

Assignment 2

 > assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22) > myMean <- function(assignment2) {return(sum(assignment2)/length(assignment2))} > myMean function(assignment2) {return(sum(assignment2)/length(assignment2))} This was the result of the code I did. Because of the function() command, it is not able to produce a numerical output. It is just returning the command as the output. However without the function command, this was the results after I ran the code:  > assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22) > myMean <- sum(assignment2)/length(assignment2) > myMean [1] 19.25

Git Hub Repository Link

https://github.com/aishwaryashiv10/Lis6371