Module 9 Assingment
For this assignment, I chose the Guns dataset from the given list, and I used it to compare different variables in R using basic R graphics, lattice, and ggplot2. The dataset allowed me to compare variables such as income, violent crime rates, and other categories.
For the first comparison, I plotted income against violent crimes, because they are both dependent continuous variables and don't overlap. I also used gun law categories to compare distributions across different groups. These visualizations help show patterns within data, as well as how different visualization tools help show these patterns in different ways.
Base R Visualization
This histogram shows the distribution of violent crimes in the dataset. It helps us identify how crime rates are spread and whether there are any extreme values.
Lattice Visualization
This plot shows the relationship between income and violent crime across different gun law categories. It helps compare between groups and identify whether patterns differ by law type.
This boxplot compares violent crimes across different gun law categories. It shows the difference in distribution, median values, and variability between different groups.
ggplot2 Visualization
This scatter plot using ggplot2 shows the relationship between income and violent crime. It offers for cleanner and easier customization when it comes to data visualization compared to the basic R functions.
This boxplot shows how violent crime varies across gun law categories. Using ggplot makes it easy to comapre the distribution between groups.
In conclusion, each of these graphic visualizition have their strenghts. Base R graphics are simple to understand and great for quick plots. However, they require more effort when wanting to customize your graphics. Lattice graphics work best when data is grouped and conditioned. Making comparisons between categories is very intuitive using lattice. The main thing ggplot 2 does best is its flexibility. The layered structure makes the visualizations very visually appealing. In this assignment, ggplot2 was the most effective for me when creating clear and polished visualizations. Lattice was useful when comparing groups, and base R was the best when it comes to simple and fast plotting.

Comments
Post a Comment