How To Calculate Month-On-Month Change In Website Traffic In R Studio
In order to plot this chart, what you’ll need:
ggplot
dplyr package + mutate function to create a calculated field [% change in monthly sessions]
In order to get the end result like this:
We first use the GoogleAnalyticsR package to pull the data from GA. Here, I have Sessions + yearMonth data for all of 2018.
We then call the library dplyr and use the mutate function to create a calculated field [month-on-month change] that shows the % values.
As you can see in the chart, the y axis has the change in decimal format instead of percentages.
Adding the scale_y_continuous parameter to the ggplot now converts the y axis to percentage format.