Posts

Showing posts from April, 2021
Image
 Hello! This week I also went over the last couple chapters in "Data Visualization with R" by Rob Kabacoff. We skipped chapters 10 and 11 since we went over most of the pertinent information they contained in previous chapters, and went straight to chapters 12 and 13. Chapter 12 is a fun chapter about interactive graphs. I had to download some additional packages to make them work, such as leaflet. Chapter 13 provides advice on how to make the graphs most appealing. It goes over labeling, picking colors, and how to best customize your graphs so they are easy and appealing to look at. Chapter 12: Interactive Graphs R does not produce these graphs on its own, and makes a connection with JavaScript to make these graphs. Unlike the other graphs in this book that look just as nice on paper as on a screen, interactive graphs need to be viewed on an app or web page. Leaflet Leaflet is a JavaScript library for interactive maps. The leaflet package in R is used to create interactive ...
Image
 Hello! This week I read Chapter 9 in "Data Visualization with R" by Rob Kabacoff. This chapter is about several different types of graphs that don't really fit in the other chapters. 3-D Scatterplot This graph is pretty self-explanatory. It can't be created using the ggplot2 package (ggplot2 can't make 3-D graphs), so we use the conveniently named scatterplot3d function in the scatterplot3d package. The book doesn't really explain what kind of information this graph is best for showing, but it uses the data in the mtcars dataframe, and shows mileage vs. engine displacement vs. car weight. Customizing the labels for this type of graph is actually very simple. You type directly what labels you want in the xyz axis, and customize the graph much like how you would other graphs. You can add vertical lines going up to each point, customize the colors of the lines and points, the weight, etc. Biplots A biplot graph represents the relationship between: observatio...
Image
 Hello! This week I looked at both time-dependent graphs in chapter 7, and statistical models in chapter 8. Time-dependent Graphs Time-dependent graphs are used to show change over a period of time.  The most common graph type used is a time series line graph, but you an also use dumbbell charts and slope graphs. Time series Time series graphs are a set of quantitative values at different time points that are an equal length of time apart. The data used for this chapter is the Economics time series included in the ggplot2 package. This shows economic data from January 1967 through January 2015. Using the scale_x_date function, you can reformat the dates. Dumbbell charts Dumbbell charts are good for showing the change in time between 2 time points for several variables. This chart uses the geom_dumbbell function from the ggalt package. For some reason my RStudio is not liking the ggalt or the geom_dumbbell() function and it keeps giving me an error. I tried looking into it ...
Image
 Hello! This week I am learning about Multivariate graphs, and Maps. Multivariate graphs Similar to bivariate graphs, multivariate graphs are used to display 3 or more variables. The two most common ways to show the relationship between variables is grouping and faceting. Grouping Grouping lets you plot data for several groups on a single graph. The values of the first two variables are mapped to the x and y axis. The other variables are mapped according to color, shape, size, and other visual characteristics. This chapter in the book uses the salaries dataset that shows the relationship between years since receiving a Ph. D and salary. There are several options you can change. For example, you can change the shape of the elements representing the sex of the professors, and different colors to show what their job title was. You can even change the size of the elements. In the picture of the graph below, the element size represents years they have been working:  You can also ad...
Image
 Hello! This week I read Chapter 4 in  Data Visualization of R by Rob Kabacoff.  Last week I read Chapter 3 on univariate graphs, which plot data about a single variable. Chapter 4 is about bivariate graph, which are used to show the relationship between 2 variables. The type of graph used depends on whether the variables are categorical or quantitative. Categorical vs. Categorical Much like a univariate graph, a bivariate graph typically uses various types of bar charts to display categorical data. There are 3 different types of bar charts used, and I'll display pictures of them all. This time, I am not going to go into detail about modifications such as color, size, etc. because it is the same as for univariate graphs. The data set used displays the relationship between automobile class and drive type: 4 wheel drive, front-wheel drive, and rear-wheel drive. Stacked bar chart The stacked bar chart is the default bar chart in R, so there are no special commands to use thi...