Posts

Showing posts from January, 2025

Module # 3 Data.frame

Data.frame > Name <- c("Jeb", "Donald",  "Ted", "Marco", "Carly", "Hillary", "Berine") >  > # Defining the ABC political poll results >  > ABC_poll_results <- c(4, 62, 51, 21, 2, 14, 15) >  > # Defining the CBS political poll results >  > CBS_poll_results <- c(12, 75, 43, 19, 1, 21, 19)  >  > # Combine into a data frame > poll_data <- data.frame( +   Candidate = Name, +   ABC = ABC_poll_results, +   CBS = CBS_poll_results + ) >  > # Print the data frame > print(poll_data)   Candidate ABC CBS 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    Berine  15  19 I worked with a dataset showing the results of ...

Module # 2 Introduction to basic R functions and Data Structures

Module # 2  LIS4370.001S25.15858 R Programming > assignment2<- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22) > myMean <- function(assignment2) {return(sum(assignment2)/length(assignment2))} > # Assign data to a vector > assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22) > # Calculate the mean > myMean <- function(assignment2) { + return(sum(assignment2) / length(assignment2)) + } > # Call the function and store the result > result <- myMean(assignment2) > # Print the result > print(result) [1] 19.25 >   assignment2 is a vector with numbers ( 16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22 ). It provides the data for calculating the average using the myMean function. The myMean function works by finding the average of the numbers in assignment2 . It adds up all the numbers with the sum() function and then divides the total by how many numbers there are, using the length() function. This is how you figure out ...

Module # 1 assignment(R)

Hey there!  Welcome to my blog about R Programming! I'm really excited to share my journey with you. Don’t forget to check out my GitHub for some cool projects I've been working on. Enjoy exploring! github.com/Ijennin