Analyzing R4DS Membership

This post is a part of #TidyTuesday and hence it is kept short. If you are here from my twitter post the code is below to generate the plot. In case you are new reader and new to R i recommend trying #TidyTuesday .

Data : R4DS Membership

library(tidyverse)
library(gridExtra)

df <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-07-16/r4ds_members.csv")


df %>% mutate(dr = daily_active_members/total_membership, 
              wr = weekly_active_members/total_membership)->df

dr <- ggplot(df,aes(x= date, y = dr))+geom_line(color ="#f03b20")+
      labs(x = "date",
           y="Daily membership (%)",
           title="Daily membership as a percent of Total membership",
           subtitle = "in %",
           caption = "#TidyTuesday")+
      theme_bw()+
      theme(panel.grid.major = element_blank(),
            panel.grid.minor = element_blank(),
            panel.border = element_blank(),
            axis.line = element_line(color = 'black'))

wr <- ggplot(df,aes(x= date, y = wr))+geom_line(color = "#c51b8a")+
      labs(x = "date",
           y="Weekly membership (%)",
           title="Weekly membership as a percent of Total membership",
           subtitle = "in %",
           caption = "#TidyTuesday")+
      theme_bw()+
      theme(panel.grid.major = element_blank(),
            panel.grid.minor = element_blank(),
            panel.border = element_blank(),
            axis.line = element_line(color = 'black'))

grid.arrange(dr,wr,nrow=1)

Leave a Reply

WordPress.com.

Up ↑

%d bloggers like this: