Posts

Showing posts from April, 2024

Final Project

Image
Problem Description The mtcars dataset contains various car attributes such as miles per gallon (mpg), number of cylinders (cyl), horsepower (hp), and weight (wt), among others. Each row in the dataset represents a different car model. The problem we’re addressing here is to understand how these attributes relate to each other. Specifically, we’re interested in the relationship between the number of cylinders a car has (cyl) and its fuel efficiency, measured in miles per gallon (mpg). The number of cylinders in a car is a key factor that can influence its performance characteristics, including its fuel efficiency. Cars with more cylinders tend to have more power, which can result in lower fuel efficiency. However, this is not always the case as other factors such as the car’s weight, aerodynamics, and engine technology can also play a role. By visualizing and analyzing the data, we aim to gain insights into these relationships. This could help car manufacturers design more fuel-efficie...

Module 13 Assignment

Image
 For this weeks assignment, I created a simple animation that displays 10 frames. Each frame is a scatter plot of 10 randomly generated numbers between 0 and 1. The following is the code used: library(animation) saveGIF({   for (i in 1:10) {     plot(runif(10), ylim = 0:1)     ani.pause()   } }, movie.name = "scatter_plot_random.gif") This generates the following animation:  

Module 12 Assignment

Image
For this assignment, I chose to use R Studio with ggnet2: network visualization with ggplot2, to create a visual social network analysis. Below is the code I created for it using the provided libraries and also the "igraph" library to generate a random graph and then using "ggnet2" to visualize it.  library(GGally) library(network) library(sna) library(igraph) library(ggplot2) # Generate a random graph with 10 nodes and a 30% chance of an edge between nodes g <- erdos.renyi.game(10, 0.3, type = "gnp") # Convert the igraph object to a network object net <- network::as.network.matrix(as_adjacency_matrix(g)) # Visualize the network ggnet2(net, mode = "fruchtermanreingold", size = "degree", label = TRUE) In this example, the mode parameter is set to "fruchtermanreingold", which means that the Fruchterman-Reingold algorithm is used for the layout of the network. The size parameter is set to "degree", which means tha...