Publications by Joey Campbell

coordsys07_demo

11.03.2020

1. Turn a stacked bar chart into a pie chart using coord_polar(). A pie chart is a stacked bar chart with the addition of polar coordinates. Take this stacked bar chart with a single category. suppressPackageStartupMessages(library(tidyverse)) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 ggplot(mpg, aes(x = factor(1), fill = drv)...

7965 sym R (915 sym/9 pcs) 7 img

posadj06_demo

11.03.2020

1. What is the problem with this plot? How could you improve it? suppressPackageStartupMessages(library(tidyverse)) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 ggplot(data = mpg, mapping = aes(x = cty, y = hwy)) + geom_point() There is overplotting because there are multiple observations for each combination of cty and hwy v...

11262 sym R (1255 sym/16 pcs) 14 img

Rstat_transform05_demo

11.03.2020

1. What is the default geom associated with stat_summary()? How could you rewrite the previous plot to use that geom function instead of the stat function? The “previous plot” referred to in the question is the following. suppressPackageStartupMessages(library(tidyverse)) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 ggplot(da...

17029 sym R (963 sym/10 pcs) 8 img 3 tbl

Rfacets03_demo

11.03.2020

1. What happens if you facet on a continuous variable? Let’s see. ggplot(mpg, aes(x = displ, y = hwy)) + geom_point() + facet_grid(. ~ cty) The continuous variable is converted to a categorical variable, and the plot contains a facet for each distinct value. 2. What do the empty cells in plot with facet_grid(drv ~ cyl) mean? How do they...

10991 sym R (619 sym/7 pcs) 7 img

Raesthetics02_demo

11.03.2020

1. What’s gone wrong with this code? Why are the points not blue? suppressPackageStartupMessages(library(tidyverse)) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, colour = "blue")) The argument colour = "blue" is included within the mapping argument, and as su...

9456 sym R (2224 sym/13 pcs) 7 img

Rviz01_demo

11.03.2020

Introduction library("tidyverse") ## Warning: package 'tidyverse' was built under R version 3.6.3 ## -- Attaching packages ----------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.2.1 v purrr 0.3.3 ## v tibble 2.1.3 v dplyr 0.8.3 ## v tidyr 1.0.0 v stringr 1.4.0 ## v readr 1.3.1 v forcats 0.4.0 ## --...

1483 sym R (2090 sym/16 pcs) 3 img 1 tbl

Lab 9 Support Vector Machines

04.03.2020

We use the e1071 library in R to demonstrate the support vector classifier and the SVM. Another option is the LiblineaR library, which is useful for very large linear problems. Support Vector Classifier The e1071 library contains implementations for a number of statistical learning methods. In particular, the svm() function can be used to fit a ...

31186 sym R (5882 sym/67 pcs) 13 img

R Assignment 4 Problem 3

04.03.2020

Let’s try this again. Load the Gross Domestic Product data for the 190 ranked countries in this data set: https://raw.githubusercontent.com/uky994/STA-4233.-INTRODUCTION-TO-PROGRAMMING-AND-DATA-MANAGEMENT-IN-R/master/GDP.csv Load the educational data from this data set: https://raw.githubusercontent.com/uky994/STA-4233.-INTRODUCTION-TO-PROGRAM...

761 sym R (1719 sym/11 pcs)

Lab 7 Non-linear Modeling

27.02.2020

In this lab, we re-analyze the Wage data considered in the examples throughout this chapter, in order to illustrate the fact that many of the complex non-linear fitting procedures discussed can be easily implemented in R. We begin by loading the ISLR library, which contains the data. library(ISLR) Attaching package: 㤼㸱ISLR㤼㸲 The follow...

37102 sym R (9372 sym/82 pcs) 12 img

Lab 6c PCR and PLS Regression

27.02.2020

Principal Components Regression Principal components regression (PCR) can be performed using the pcr() function, which is part of the pls library. We now apply PCR to the Hitters data, in order to predict Salary. Again, ensure that the missing values have been removed from the data, as described in Section 6.5. library(ISLR) Attaching package: �...

10790 sym R (4313 sym/20 pcs) 3 img