Wednesday, March 20, 2024

LIS 4317 Visual Analytics - Module 10 Assignment

For this week's assignment, we are asked to make improvements to any of the given data visualizations from the Yau textbook or the economics dataset visualizations.

Right off the bat, I must admit that many of these visuals already looked perfect but I attempted to make some improvements.

Starting off with visual 2 of the hotdog dataset from the Yau textbook, the first thing that came to mind was how it could use an annotation to point out the highest on record number of hotdogs eaten as well as the name of the record holder. To do that, I simply added onto the current graph and placed a point so that viewers have an easier time picking it out.

Moving onto the economics dataset, I was intrigued by the line chart of visual 4 that showed the unemployed population over time. Looking at the other variables in the dataset, I wanted to see if I could a do a direct comparison of the unemployed over time versus the median duration of unemployment or uempmed. To do that, I was to generate two line charts of these variables and then place one on top of the other in a single visual. 

All in all, it was interesting working with time series data and I hope to come across more datasets that specifically pertain to time series.

~ Katie

LIS 4370 R Programming - Module 11 Assignment

In this week's assignment, we are asked to locate a bug that was deliberately placed inside a function.

The objective:

Find the bug and fix the code and discuss your debugging procedure.

Buggy code:

Fixed code:

Debugging Procedure:

To begin the debugging process, the first step was to run the code to look for any glaring errors that pop up. Upon running the code, I got the following syntax error message:

This error appears to be from the second for loop in the function, more specifically, the placement of the return statement. Currently, it is after one of the curly braces when it should be placed outside the loop. With this information in hand, all you need to do is to move the return statement to outside the loop. For better readability, it is a good idea to drop a line for each ending curly brace.

Check out the code here: Module 11 Code

~ Katie

Saturday, March 16, 2024

LIS 4370 R Programming - Module 10 Assignment

 sentimentTextAnalyzer R Package Proposal

Introduction:

The sentimentTextAnalyzer package aims to provide a comprehensive tool for analyzing textual data to extract sentiment insights. With the increasing volume of text data generated on various platforms, understanding sentiment is crucial for businesses and researchers alike. sentimentTextAnalyzer offers a robust solution for sentiment analysis, enabling users to extract positive and negative sentiment signals from diverse sources such as URLs and flat text files.

Objectives:

  • Develop a versatile R package, sentimentTextAnalyzer, capable of analyzing text data for positive and negative sentiment.
  • Implement algorithms to parse text efficiently and extract sentiment insights.
  • Enable the package to generate word clouds highlighting the most frequent words in the text data.
Key Features:
  • Text Parsing: Implement algorithms to parse text from various sources, including URLs and flat text files.
  • Sentiment Analysis: Develop algorithms to identify positive and negative sentiment words and calculate their frequency in the text.
  • Word Cloud Customization: Enable the package to generate word clouds depicting the most common words in the text data.
  • Customization: Allow users to customize sentiment analysis parameters and word cloud generation options.
Methodology:
  • Text Parsing: Utilize natural language processing (NLP) techniques to preprocess and tokenize text data. 
  • Sentiment Analysis: Implement sentiment lexicons and algorithms to identify positive and negative sentiment words.
  • Word Cloud Generation: Utilize packages such as wordcloud2 to generate visually appealing word clouds based on word frequency. 
  • Package Development: Utilize R programming language and relevant packages (e.g., tidyverse, text mining) to develop the sentimentTextAnalyzer package. 
  • Testing and Validation: Conduct thorough testing and validation to ensure the accuracy and reliability of sentiment analysis results.

Following this link will take you to the package's description file which provides a few details regarding licensing, potential dependencies, and the current version of the package: DESCRIPTION

~ Katie

Tuesday, March 5, 2024

LIS 4370 R Programming - Module 9 Assignment

In this week in R Programming, we are asked to select a dataset from the Vincent Arel Bundock dataset list and create visualizations from that data.

Link to the list: Vincent Arel Bundock Datasets

I decided to work from the pizzaplace.csv dataset which contains sales, pizza type, and size data over an entire year. 

In the instructions, it is mentioned that there are three ways to make visualizations in R: Base R, Lattice package, and ggplot2 package. Thus, I will generate visualizations from these listed methods.

In base R, let's make a "pie" chart that determines the occurrences of each of the 4 types of pizzas sold:

As for the second visual, let's use the lattice package to explore the relationship between prices and pizza size:

Moving on to the third visual using the ggplot2 package, the data was separated by facet to make it easier to compare trends between the four types of pizza and their associated sales over time:

After creating the visuals using the three different methods, I must admit that it is interesting to see how each method does have its pros and cons. For example, I do like to use the base R method but things can get complicated fast with having to call out all the individual methods. To make the first visual better, I should include percentages for each of the four types of pizza sold. Moving on to the second visual, I do not have too much experience using the Lattice package but I do think that the visual came out well in telling a story with the data. For instance, it still weirds me out that someone bought a super expensive small pizza that surpassed the price of a large pizza. Lastly, the ggplot2 visual really puts into perspective which pizza type is the most expensive in terms of sales like classic going above 30. 

Check out the code here: Module 9 Code

~ Katie 

LIS 4317 Visual Analytics - Module 9 Assignment

In this week of Visual Analytics, we are asked to create a multi-variate visualization graph with a dataset of our choice.

In this case, I decided to work with a dataset called nyc_squirrels.csv and basically it contains very detailed observations from squirrel watching in New York City's Central Park. From what they were doing, what sound they made, to even the exact geo coordinates of where the squirrel watching event occurred, it is all noted down in the data. 

Link to where I found the data: NYC Squirrels Data

From this data, I decided that I wanted to better understand the spatial distribution of squirrel sightings and see if there is any difference in sightings that occurred in the AM or PM.

To begin my analysis, I did make a point to clean my data containing entries with NA values and deleted variables that were not conducive to the analysis.

With the data ready, I used the ggplot2 package in R to graph the points:

Here is the visual: 

As you can see, when the geo coordinate points are plotted, it actually makes a rough outline of Central Park. The big empty gap you are seeing represents Jacqueline Kennedy Onassis Reservoir so it makes sense that there were not any squirrels spotted there. For the most part, I do not see any particular difference in squirrel sightings in the AM versus PM but there does appear to be more squirrel sightings at night than during the day.

For fun, let's see what this plot looks like in Tableau with a map underneath the points:

See the map up close here: NYC Squirrel Sightings

Wrapping up, visualizing multi-variables can be very helpful when it comes to understanding the subtle relationships between them. It is definitely interesting to be able to compare AM sightings to PM sightings and where they occurred in Central Park and allows for one to better understand the dataset.

As for applying the 5 principles of design, alignment is used for the axis labels, legend, and title for better readability. With repetition, shape style, color, font size, and type are kept consistently. To highlight the difference between day and night, I opted to use cool colors most often associated with the night for PM and warm colors for AM which checks off the contrast requirement. Moving on to proximity, visual elements like the legend are clearly placed together to promote connection. Lastly, with balance, I must admit that the Tableau visual is not as balanced as the previous ggplot visual. It has very small legend which makes it have uneven weight. To prevent this, I should think about adding more data elements to make the visual more balanced.

~ Katie

Thursday, February 29, 2024

LIS 4317 Visual Analytics - Module 8 Assignment

In this week in Visual Analytics, we are asked to generate a visual from the mtcars dataset that is either based on correlation and regression analysis.

In this case, I will be conducting correlation analysis on the variables number of cylinders (cyl) and horsepower (hp). That is, I want to know if these variables have a positive correlation or negative correlation relationship.

Let's begin by plotting the relationship via ggplot2 in a scatterplot. I will also draw in a line of best fit using the lm argument.

Here's my code:

The resulting output:

Interestingly, there appears to be a rather strong positive correlation between the number of cylinders and horsepower. Perhaps, this is alluding to cars that have a greater number of cylinders have a higher horsepower. Let's take a look at the correlation coefficient.

With a value of .832, that's a pretty high correlation value!

Lastly, let's finish up by creating a linear regression model of these variables:

Looking at the significance codes, cyl is highly significant at the (***) mark at 0.001. However, the model can only capture about 68% of the variability so it is a moderately strong correlation.

Reflecting on the design remarks of Few from the textbook, my visual does follow a few of his best practices. To begin, I do feature some grid lines for greater readability of graph and one can easily determine the points and where they fall in terms of cyl and hp. However, I do see how grid lines can be helpful if multiple scatter plots are used in the analysis. In addition, my visual also has a line of best fit so that we easily see the correlation's linear shape and positive slope.

I appreciate Few's recommendations when it comes to visualizing correlations between variables. Although my visual does not include all his suggestions and I know that they will be helpful for other datasets.

~ Katie


LIS4370 R Programming - Module 8 Assignment

For this week's assignment in R Programming, we are to do the following:

Step 1: Import txt file in R. This file is called Assignment 6 Dataset.txt

Step 2: Use ddply from the plyr package to generate mean of Age and Grade variables split by Sex variable, this will be saved to new variable, Grade.Average

Step 3: Create a new txt file containing new variable Grade.Average. This new txt file will be called Sorted.Average

Step 4: Separate values in Sorted.Average by comma using sep argument, and save it back to Sorted.Average

Step 5: Using the original txt file, filter the names in the list that contain the letter (i). Then, save the result to a new file called DataSubset with the values separated by comma.

Let's take a look at our new files:

Sorted.Average:

DataSubset:

As you can see by the resulting output, the values are separated by commas and the variables are differentiated as they are surrounded by double quotes. 

See the code on GitHub: Module 8 Code

~ Katie

LIS 4370 R Programming - sentimentTextAnalyzer2 Final Project

For this class's major final project, I set out to make the process of analyzing textual files and URL links for sentiment insights much...