Author Archives: Henry

Marketing Analytics with R – Google Search Console

I have been exploring a couple of marketing platforms in my new job as a Marketing Analyst. One of the daily jobs which I like most is to use R to dig into data across different marketing channels to come up with new ideas and recommendations for our marketing activities.

Google Search Console

Google Search Console is one of the platforms I have been playing with recently. As you may already know, Google Search Console is a useful website tool for marketers to check website overall performance (e.g., search engine crawl and index issues, google search performance). For example, here is the performance report for my personal blog:

Continue reading

ROC Curve Simulation – Classification Performance

“A receiver operating characteristic curve, or ROC curve, is a graphical plot that illustrates the diagnostic ability of a binary classifier system as its discrimination threshold is varied. The ROC curve is created by plotting the true positive rate against the false positive rate at various threshold settings.” – Wikipedia

Simulation can be very useful for us to understand some concepts in Statistics, as shown in Probability in R. Here is another example that I used simulation to understand ROC Curve and AUC, the metrics in classification models that I had never fully understand.

Data

The simulation in this post was inspired by OpenIntro Statistics and the email dataset I used can be found in openintro package.

Continue reading

R Markdown to WordPress with goodpress

I have been writing a few posts about R on my blog and are getting annoyed with the workflow back and forth between RStudio and WordPress. Overall, the previous workflow has two main pitfalls making me frustrated:

  • R Code

Coping R code from RStudio and pasting it to WordPress can take me much time. Code highlight is also challenging, although eventually I figured out that the plugin of SyntaxHighlighter Evolved did a great job.

  • R Output

Often I need to export R outputs (e.g., ggplot2 plots) and upload them to WordPress, sometimes formatting them a bit.

Continue reading

Learning ggplot2 on Paper – Scale

The previous two posts in this series of learning ggplot2 on paper:

This post will continue to discuss another ggplot2 component, Scale. Let’s start with the graphs we drew in the last post of “Learning ggplot2 on Paper – Layer“, as shown here.

Figure 1
Continue reading

Learning ggplot2 on Paper – Layer

The previous post in this series: Learning ggplot2 on Paper – Components. The last post introduced ggplot2 seven components at a high level and how they are related to the way we draw math function graphs on paper in middle school.

This post will dive into the components of the layer, which is one of the most important ggplot2 components.

step6

Let’s start with Step 6 in the last post, in which we were trying to draw two graphs side by side on the paper. In order to compare the patterns in two different datasets, we kept the same scales on the axes. You may wonder we can also draw two datasets on one graph as the scales are the same, as demonstrated below (the second dataset is drawn in red points).

Continue reading