Posts

Showing posts from March, 2024

Module 11: Plotting Dr. Piwek's graph.

Image
 I opted to attempt to display Piwek's ggplot2 implementation. After some fuss over getting the libraries loaded, I was met with very promising results after running the code provided:

Module 12 Assignment: Visual Social Network

Image
 For this assignment, I once more opted to use RStudio, as it's what I more used to when it comes to creating visual representations of data. To get started, I opted to try out the example code left on the assignment page to get a sense of how RStudio handles projects like this. Once it was made more clear how to make such visual plots, I aimed to experiment with a template dataset and see what I could make. While it was certainly a fun visual exercise, there's still a lot I want to try to research regarding how analysis plots like this can be made, including how to add more details that can be shown through varying visual devices, like colors and different shapes for each node, as well as better labeling for the legend.

Module 11: Debugging in R

Image
 Upon loading in the given code example for this assignment, the first thing I attempted to do was to simply run the code and see what would happen in order to better isolate a potential issue. That gave me the error shown here: Clearly something was amiss with the return argument, so that was the line I checked. It became obvious looking at it further that said argument shouldn't have been part of the same line as the line in brackets, so I isolated it into its own line. Making this fix allowed the code to be properly executed, and for the function to be created. Next was testing the function with an example matrix. Initially, it failed with this error: This exposed the other issue with the functions code; it seemed to depend on another function dubbed tukey.outlier that was completely missing, and therefore was interfering with the function's ability to be properly used. Commenting the line out and redefining the function allowed it to properly work once more. Resulting code ...

Module 10 Assignment: Time Series with ggplot2

Image
 Experimenting with data over a span of time is something I've done with ggplot2 for quite some time; one such example was during the previous year when I wrote a series of functions to create visualizations of the price of certain videogames over the course of a decade. For this assignment, I opted to go for something more simple: a line graph showing the rate of employment from the late 1960's up to the mid-2010's using data from the economics dataset. ggplot ( economics , aes ( x = date , y = unemploy ) ) + geom_line ( ) + geom_smooth ( ) + labs ( title = "Time Series Plot of Unemployment with Smooth Trend Line" , x = "Date" , y = "Unemployment" ) + theme_minimal ( ) The addition of a trend line makes the data presented here more easily understandable to onlookers, with the main message of the data being made clear in the presentation, that being that unemployment in recent times has been steadily incre...

Final Project Proposal: DescribeR

 For the R package to make at the end of this course, I've decided to make a package called DescribeR. This package (hopefully) will be able to instantaneously provide a detailed summary of any data type given to it, from a typical variable held within RStudio's memory to descriptions of the columns in a given data frame. I'd also like to have the package utilize ggplot2 to make example visualizations of data frame information so as to better have the user understand the variables in said data frame and how they relate to one another. No two graph outputs should be alike when coming from the same data frame. GitHub link to description file: https://github.com/Retrolovania/R_Programming/blob/main/DescribeR/DESCRIPTION.txt

Module 9 Assignment: Three Types of Graphs

Image
 For this assignment, I used the Guns dataset from Vincent Arel Bundock's list. Said dataset contains various information related to gun-related crimes committed in the United States during the later 20th century. In terms of graphing, I experimented with making a different type of graph for each library we've gone over, including base R, lattice, and ggplot2. While all three implementations of visual plotting have their own individual strengths and weaknesses, I feel ggplot2 is the better out of the rest, since it takes the good parts of the other two (base R's simplicity and lattice's ability to work better with large amounts of data) and introduces more versatile elements to work with. GitHub code: https://github.com/Retrolovania/R_Programming/blob/main/Module%209.R

Module 9: Multivariate Graph in R

Image
 Using the mtcars dataset, I sought to make a graph that mainly compares the miles per gallon a car can have by the weight of said car, with other variables in the dataset being used to add more detail to each point on the graph. Looking at the results, it's clear to see that a heavier car has correlation with cars that get lower gas mileage, even with more cylinders in the engine or higher rates of horsepower. The graph is able to communicate this point clearly and effectively by following the five core principles of design, including maintaining simplicity, putting emphasis on cars with higher levels of certain variables by affecting the point's size and color, maintaining visual balance, having the data be consistent, and having the data organized in hierarchical data, with the heaviest weights followed by the lightest.