Articles by R on jmarriott.com

XKCD-Gutenberg Passwords

December 20, 2020 | R on jmarriott.com

I have been inspired by this informative XKCD comic on password security, and I often follow its advice by using random-word-generating websites. But I have to wonder what dictionaries these sites use and how random the words are that they spit out. So I thought that it would be fun ... [Read more...]

VLOOKUP in R with Schwartau Beehive Data

July 1, 2019 | R on jmarriott.com

I started learning R back in 2016 in college thanks to a couple of my professors who used it to teach statistics: Dr. Grimshaw and Dr. Lawson. Thanks to the R community I’ve learned a lot more since then, but recently I did an embarrassing Google search for “how to ...
[Read more...]

Individuals Control Charts

May 27, 2019 | R on jmarriott.com

This post is a follow-up two my two recent posts on generating control charts in R, and animating them. One thing that I’ve been wondering about is how to calculate a range chart without using a package like ggQC or qcc. I knew that I could do it using ...
[Read more...]

How to Animate a Control Chart

April 4, 2019 | R on jmarriott.com

Recently, I wrote a post about creating control charts in R, and now I want to experiment with animating one of those charts. Lets start with the tidyverse, gganimate, and ggQC.
library(tidyverse)
library(gganimate)
library(ggQC)
Now, lets rebuild the last control chart from my previous post.
# Generate sample data
set.seed(20190117)
example_df <- data_frame(values = rnorm(n=30*5, mean = 25, sd = .005),
                         subgroup = rep(1:30, 5),
                         n = rep(1:5, each = 30)) %>%
  add_row(values = rnorm(n=2*5, mean = 25 + .006, sd = .005),
          subgroup = rep(31:32, 5),
          n = rep(1:5, each = 2)) 

violations <- example_df %>%
  QC_Violations(value = "values", grouping = "subgroup", method = "xBar.rBar") %>%
  filter(Violation == TRUE) %>%
  select(data, Index) %>%
  unique()

ggQC_example <- example_df %>%
  ggplot(aes(x = subgroup, y = values)) +
  stat_summary(fun.y = mean, geom = "line", aes(group = 1)) +
  stat_summary(fun.y = mean, geom = "point", aes(group = 1)) +
  stat_QC(method = "xBar.rBar", auto.label = TRUE, label.digits = 4) +
  scale_x_continuous(expand =  expand_scale(mult = c(.05, .15))) + # Pad the x-axis for the labels
  ylab("x-bar") +
  theme_bw() +
  geom_point(data = violations, aes(x = Index, y = data), color = "red", group = 1)
ggQC_example
You can see that I added ...
[Read more...]

Creating a Favicon with R

February 28, 2019 | R on jmarriott.com

I use the Hugo Coder theme for this website, but I don’t like the default favicon, so I decided to make a new one using ggplot2. For those of you who don’t know, a favicon is the little icon that shows up on your browser tab next to ...
[Read more...]

Testing out ggQC

February 10, 2019 | R on jmarriott.com

R is a great language for statistical process control largely because there are several packages which make it quite easy, including qcc, SixSigma, and a new one that I want to explore in this post called ggQC. I’ve been using qcc for a while and I trust its calculations, ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)