Posts

Showing posts from February, 2026

Week 6: Doing Math pt2

Image
Week 6: Doing Math pt2 This week we covered more matrices and how to use certain functions to manipulate them. R is also already quite handy at dealing with these concepts so without further ado, I will show the entirety of my code, then its outputs in parts where I will explain either what we see, what I did or both. Okay, so now I will show the output for the first 8 lines and discuss: The first 2 lines are simply the copying and creating of the matrices used in this assignment. The first thing we were asked to do was add matrix a and matrix b, so I did just that, and stored the result in a variable called plus, which was then printed. I did the same basic idea but with subtraction for a - b stored in variable minus. I then used the diag command as was suggested by the professor to create the second matrix that was requested by the assignment instructions, storing the result in matrixOne, then printing the result to the screen for confirmation.  The first thing I did to produce t...

Week 5: Doing Math

Image
  Week 5: Doing Math      This week we were tasked with learning about matrices and finding the inverse value and determinant of a matrix using some provided values. I will show my code in parts, explaining as I go along what everything means, as well as what the error codes reveal. This was a fascinating week, and the assignment really makes you think!     The first thing we can see is that A appears to be a 10x10 square matrix, whereas B is not with its dimensions being 10x100. We also see that the determinant of A is 0, which we take to mean that A is singular, and no inverse of it exists.      As I mentioned, A is singular as is confirmed by the error message, and as a result cannot be inverted which is attempted by the solve A command. In other words, it tries to Solve A (invert A) but fails to do so and when not placed in the tryCatch, causes the code to fail without running the rest of the program. We see similar occurrences when we at...

Week 4: Programming Structure in R

Image
  Week 4: Programming Structure in R      This week was interesting, I'm currently taking visual analytics, predictive analytics, and data text mining so they're all really bleeding into each other quite beautifully. Visiting box plots and histograms is always enlightening in terms of what they can generally reveal about a particular dataset.  With this information at the front of our minds: (Raw data) My code followed by the output:      Frequency here is just taken to mean number of people that falls within that range. There are 2 people under 50 for instance. It can be said from the boxplot that most fall within the 60-120 range for blood pressure, with some ranging to 200 and going as low as 10 it appears. The histogram confirms that most fall within what would be termed a reasonable range, that is 50-150, but the data is skewed by the 4 people that fall in the 0-50 and 150-250 ranges.       From the raw data we can also se...
Image
 Assignment 3: Data Frames     This week we discussed data frames and were provided with a data set covering a past American election using fictional values made up by the professor. To fit the theme of the week, I took the data provided, placed it within a data frame and then printed it back out to present the information even more clearly. That code is displayed here: Although the data frame doesn't edit the data, it does make it more digestible. We can more easily see that the least popular candidates were Carly by far with only 3 votes, and Jeb with a total of 16. We can say that the average person got more than 15 votes per poll, with Donald far exceeding the other candidates in both polls. Ted followed in second and the other candidates got under 40 votes total. We can note that both polls, although discussing the same 7 people, had varying results amongst those polled. Some people had similar votes, such as Carly, and Marco who only varied by one or two, but for ot...