Posts

Module #7

  Definitely been a while since I've seen the object oriented side of any programming language . My first language with C++ and I took that class in 2015. In this module I'll be making my own data and grabbing some data from a previous class.  The first thing I did was load the data from an Excel spreadsheet. It was data on my playlists in Spotify. First I check out the data using the head function and then use the list function they both look the same and then I use the STR function which yielded different results such as giving me more information on the data Types of each column. By using the is S4 function we can determine that the data loaded is not S4.  Then I create S3 data. I do this by using a simple list function. I use the class and attributes too. Then I create s4 data using the new function but before I use that I must create a class otherwise it will not work… and I did try.  How do you tell what OO system (S3 vs. S4) an object is associated with? Thi...

Module #6

 In this module, we did more math with matrices!  We were asked to examine two matrices, add them, minus them, and then use the diag() function. We were also asked to replicate/recreate a matrix with certain criteria.  #Start with two matrices A = matrix(c(2, 0, 1, 3), ncol = 2) B = matrix(c(5, 2,4, -1), ncol = 2) #Call/View matrices A      [,1] [,2] [1,]    2    1 [2,]    0    3 B      [,1] [,2] [1,]    5    4 [2,]    2   -1 #It appears that both matrices are the same size, therefore can be combined, added, subtracted.. etc..  # Find A + B C <- A + B #Call / View matrix C      [,1] [,2] [1,]    7    5 [2,]    2    2 # Find A - B D <- A - B #Call / View matrix D      [,1] [,2] [1,]   -3   -3 [2,]   -2    4 #Use the diag() function to build a mat...

Module #5

 This week our assignment was to inverse two matrices.  #Matrices A <- matrix(1:100, nrow = 10) B <- matrix(1:100, nrow = 10) #Transpose A_T <- t(A) B_T <- t(B) #Create two vectors A_vec <- c(1:10) B_vec <- c(1:100) #multiply matrices by vectors A_x <- A %*% A_vec B_x <- B %*% B_vec #re-assign the vectors a and b to equal the number of rows of the column for the #corresponding matrix A_vec <- nrow(A) B_vec <- nrow(B) #Multiply the matrix by a matrix C <- A %*% B #Inverse the matrix S <- matrix(2:5, nrow = 2) solve(S) Please see my Github! https://github.com/Midiquin/LIS4370.720S21/blob/main/Mod3.R

Module #4

Image
 This week we were asked to create a boxplot and histogram of faux local hospital data. As well as discuss the outcome of our results regarding patients' BPs & MD’s Ratings. From the first graph (boxplot), we can observe that patients with a higher final decision had visited the hospital more frequently than the lower final decision. We can also observe that those with higher blood pressure visited the hospital more frequently than those with lower blood pressure.  The second graph (histogram), displays that there were more "bad" first assessments with the patients with one N/A.   The second graph (histogram2), displays that there were more "high" blood pressure assesments by doctor #2.   library(ggplot2) #Data  p1<- c(0.6,103,'bad','low','low') p2<- c(0.3,87,'bad','low','high') p3<- c(0.4,32,'bad','high','low') p4<- c(0.4,42,'bad','high','high') p5...

Module #3 Post

Image
This week's assignment was to create a data frame from the following data then explore and post our findings.  We were given imaginary poll numbers from the previous election. As observed in the bar charts created, the candidate Ted was significantly more popular with ABC watchers than CBS. The candidate Jeb was more popular with CBS watchers than ABC.  # library library(ggplot2) Name <- c("Jeb", "Donald", "Ted", "Marco", "Carly", "Hillary", "Bernie") ABC_poll<- c(4, 62, 51, 21, 2, 14, 15) CBS_poll<- c(12, 75, 43, 19, 1, 21, 19)   #Creates Data Frame from the above values DF <- data.frame(Name, ABC_poll, CBS_poll) #Returns the first 4 of DF head(DF) #Returns how many rows/columns dim(DF) #Returns names of columns names(DF) #Function to graph the poll results.  GraphIT <- function(Poll){   News_Plot <- ggplot(data=DF, aes(x=Name, y=Poll, fill=Name, label=Poll)) +     geom_bar(stat = "identit...

Module #2 Post

Hello, world! This week's assignment was to evaluate the following function/code. assignment2 <- c(16, 18, 14, 22, 27, 17, 19, 17, 17, 22, 20, 22) myMean <- function(assignment2) { return(sum(assignment)/length(someData)) } # This function does not work because of several reasons.  # First reason is someData is not defined # Second is that the varible names are different within the function, # 'assignment2' does not equal assignment. # Third is that the function is not called.  # Below I have fixed the function. someData <- c(4) myMean2 <- function(var) { return(sum(var)/length(someData)) } myMean2(assignment2) Please see my Github! https://github.com/Midiquin/LIS4370.720S21/blob/main/Mod2.R

First post

 Hello world!