• R from afar

    R Markdown Reports On Demand with MobileTrigger

    R markdown is great for building reports that are easily re-rendered based on new or evolving data. But when you're on the road and can't run your R markdown report, what do you do? Usually, I'd say enjoy the fact that you're on the road or holiday and leave it for an official day at the office. But sometimes your boss, peers, or direct reports need the report and won't stop calling you. One way to deal with the need a report when out of office problem is to use the R MobileTrigger package. The MobileTrigger package gives you the ability to request output from R models, scripts, and markdown…

  • R from afar

    MobileTrigger Setup: Run R Scripts, Models, Reports with Mobile Device

    Say hello to the MobileTrigger package. With it, you can run R scripts, models, and reports from a mobile device using e-mail triggers. In its debut offering, version 0.0.31 of the package provides List and Run trigger functions. The list function allows you to see available scripts, models, and reports. Complimenting list, the run function allows you to launch and interact with R while you're traveling and cannot be at your desk to run R directly. In this post, we'll cover MobileTrigger installation and setup. Follow-up articles will detail how to set up scripts, reports, and models for mobile execution and interaction. The Concept In Running Remote R Scripts with…

  • R from afar

    MailR SMTP Setup (Gmail, Outlook, Yahoo) | STARTTLS

    The mailR package allows you to easily send e-mails with R, but you need the right mailR SMTP settings. Getting the SMTP settings just right to establish a connection to e-mail hosts like Gmail, Outlook, or Yahoo can be challenging. This is especially true when there are some settings you need to change on the host side to make everything work. In this post, I'll show you how to connect to the major e-mail providers such as Gmail, Outlook, Yahoo, Hotmail, and AOL. For each host, you'll get the SMTP host name, ports and login requirements. In addition, I'll show you how to deal with STARTTLS, the default secure communications…

  • teaching

    Learning and Teaching R | Get to the Plot

    As an experienced R user, I have seen numerous social media posts and perhaps even a few stackexchange requests over the years asking the question, “how do I learn R?”. This is a great question. A related one is, “how do I teach or coach R?” To the would-be student, I ask, “What attracted you to R in the first place?” I suspect it wasn't that it was free, though this is a reasonable motivation considering the cost of comparable commercial software. To the newcomer, were you attracted to R because of a graph you saw on the web, in a lecture, presentation or article? Teachers, what drew you to…

  • Ergonomics

    Super Dark IDE Theme, R-Studio, Inverted Color

    A dark IDE theme may increase visual comfort and productivity for those spending extended amounts of time coding, writing, and reading at a computer terminal. Why? If your 9 to 5 has you chained to a computer, you’ve likely experienced eye strain. Typical symptoms include soreness, irritation, and difficulty focusing your vision. All of which will slow your productivity. In this post, we’ll make work environments like R-studio even easier on the eyes, by making it truly “dark”, including your plot area, window frames, etc. The nice part about the solution I’ll be sharing with you is it even works for word processor and spreadsheet software, which have always been…

  • rlang

    Run Remote R Scripts with Mobile Device using E-mail Triggers

    Have you ever been on the road and wished you could run an R script from your mobile device and see the results? Maybe you’re a business person who needs a quick update on a project or production schedule. Or, possibly you need an up-to-the-minute report out for a meeting, and you don’t have a “cloud based solution to get you the important data. In short, there is data you want and can’t get because you’re not onsite to run an R script. In this post, I’ll show you how to resolve this issue using headless R and E-mail triggers. Objectives: Run an R script from a mobile device Review…

  • WooCommerce

    WooCommerce Image Gallery | Step by Step, Automate with R

    Setting up a WooCommerce image gallery for your shop is a grueling process if you use the online forms. Thankfully, you can import goods and setup an image gallery using a simple CSV file. Now, if you have a few products and a few images for each product, preparing the CSV for bulk import using your favorite spreadsheet program is trivial. But, if you have lots of products and lots of images per product, manually creating the CSV via spreadsheet becomes a considerable task. However, if we know the CSV structure, we leverage R to help us automate this task in a more scaleable way. Objectives: Understand what’s in a…

  • control charts

    XmR Chart | Step-by-Step Guide by Hand and with R

    Is your process in control? The XmR chart is a great statistical process control (SPC) tool that can help you answer this question, reduce waste, and increase productivity. We'll cover the concepts behind XmR charting and explain the XmR control constant with some super simple R code. Lastly, we'll cover how to make the XmR plot by hand, with base R code, and the ggQC package. Objectives: When you’re done with this post, you should: Grasp the XmR chart concept and utility Understand the math necessary to create the XmR chart by hand, and why moving range should be used instead of standard deviation to determine control limits. XmR Chart…

  • control charts

    XmR Control Limits | Why Moving Range, not Standard Deviation

    So, you want to know why we use mean moving range, mean(mR), and not standard deviation to determine XmR control limits. Before answering, let's do a quick review to make sure we are starting on the same page. The mean(mR) is determined by first finding the absolute difference between sequential pairwise measurements. This gives you a series of moving ranges – mR. Next, you calculate the mean of those ranges to give you mean(mR). Below are some sample calculations. Once you've determined the mean(mR), you are in a position to calculate the sequential deviation: mean(mR) / 1.128. By multiplying the sequential deviation by ± 3, we can establish the XmR…

  • control charts

    Control Chart Constants | Tables and Brief Explanation

    Jump to Control Chart Constants: Bias Correction Constants: d2, c4, d3, d4 XmR Constants (n=2): d2, A2, D3, D4 XbarR Constants: d2, d3, A2, D3, D4 XbarS Constants: c4, A3, B3, B4 Control chart constants are the engine behind charts such as XmR, XbarR, and XbarS. And, if you've made a control chart by hand or sat in a class, you'll likely have memories of bizarre constants like d2, A2, etc. To me, control chart constants are a necessary evil. Why? Because, it's a nuisance to look up a constant to make a chart, and I suspect that has likely frightened away many would be users over the years. These…

  • control charts,  ggQC

    ggQC | ggplot Quality Control Charts – New Release

    The ggQC package is a quality control extension for ggplot. Use it to create XmR, XbarR, C and many other highly customizable Control Charts. Additional statistical process control functions include Shewart violation checks as well as capability analysis. If your process is running smoothly, visualize the potential impacted of your next process improvement with a Pareto chart. To learn more, read on! To get started with ggQC, install it from CRAN by running the following code: 1 install.packages("ggQC")install.packages("ggQC") ggQC Control Charts Control charts are a great way to monitor process outputs, drive improvement, and evaluate measurement systems. The types of control chart types supported by ggQC include: Individuals Charts :…

  • IO,  rlang

    Windows Clipboard Access with R

    The windows clipboard is a quick way to get data in and out of R. How can we exploit this feature to accomplish our basic data exploration needs and when might its use be inappropriate? Read on. Overview Paste Data from Clipboard to R HTML Tables Spreadsheets Copy Data from R to Clipboard Summary and Usage Notes Paste Data from Clipboard to R We won't be using it in this post, but you can see the contents of the Windows clipboard in R using the readClipboard() command. Going through the documentation you'll note a variety of formats that can be read. For our purposes, we are looking at moving text…

  • Shiny Lost in the Braces
    Shiny

    Source and List: Organizing R Shiny Apps

    Keeping R Shiny code organized can be a challenge. One method to organize your Shiny UI and Server code is to use a combination of R’s list and source functions. Another method to organize you’re Shiny code is through modularization techniques. Here though, we’re going concentrate on the list and source options. If you feel comfortable with Shiny and want to get strait to the answer, check out the Solution section. Otherwise, read on! Outline Difficulty Organizing Shiny UIs A UI Source Example That Usually Doesn’t Work When Source Fails in the UI Solution Usage Note Organizing the Shiny Server with Source Summary Difficulty Organizing Shiny UIs If you have…

  • control charts

    Estimating Control Chart Constants with R

    In this post, I will show you how a very basic R code can be used to estimate quality control constants needed to construct X-Individuals, X-Bar, and R-Bar charts. The value of this approach is that it gives you a mechanical sense of where these constants come from and some reinforcement on their application. If you work in a production or quality control environment, chances are you’ve made or seen a control chart. If you’re new to control charting or need a refresher check out Understanding Statistical Process Control, Wheeler et. al. If you want to dive in and start making control charts with R, check out R packages ggQC:…

  • rlang

    Infamous Inf – Part II

    R’s Inf keyword – Have you’ve ever wondered what to do with it? If so, this is the second in series of posts that explore how we can exploit the keyword’s interesting properties to get the answers we need and improve code robustness. If you want to catch up on the first post where we look at Inf and the cut() function, please see Infamous Inf – Part I For those unfamiliar with R’s Inf keyword, it is defined as a positive or negative number divided by zero yielding positive or negative infinity, respectively. c(plus_inf = 1/0, minus_inf = -1/0) # plus_inf minus_inf # Inf -Inf Sounds very theoretical. So…

  • rlang

    Infamous Inf – Part I

    R’s Inf keyword – Have you’ve ever wondered what to do with it? If so, this is the first in series of posts that explore how we can exploit the keyword’s interesting properties to get the answers we need and improve code robustness. For those unfamiliar with R’s Inf keyword, it is defined as a positive or negative number divided by zero yielding positive or negative infinity, respectively. c(plus_inf = 1/0, minus_inf = -1/0) # plus_inf minus_inf # Inf -Inf Sounds very theoretical. So how we can make practical use of infinity in R? In this first post, we’ll be discussing how Inf can make binning data with cut() a…

  • ggQC

    Control Charts with ggQC: XmR

    Preparing an XmR plot is common when dealing with processes where a single product/item is made or measured and there is a significant time gap between the next production or observation. XmR plots can also be useful when dealing with outputs from a batch process rather than a continuous one. In this post, we will show how to make quick QC XmR plots with the ggQC package available on cran or github. cran: install.package("ggQC") To get us started, let’s simulate some data on the diameter of a golden egg produced monthly by a golden goose. set.seed(5555) Golden_Egg_df <- data.frame(month=1:12, egg_diameter = rnorm(n = 12, mean = 1.5, sd = 0.2) )…

  • ggQC

    Control Charts with ggQC: XbarR

    XbarR charts are useful when monitoring a continuous process over time and your taking multiple samples in a given period. Some examples might include, the first, middle, and last parts coming off an assembly line, subgroups of molded parts produced several at a time over several cycles, batch uniformity of continuously produced chemical / material. In this post, we will show how to make quick QC XbarR plots with the ggQC package available on cran or github. cran: install.package("ggQC") Generating an Xbar or XbarR plot with ggQC is simple. To get us started, let’s simulate some production line data on candles. The candles are shaped using a mold capable of producing…