├── .DS_Store ├── README.md ├── Talk_online_analytics_report.pdf ├── Talk_online_analytics_report.pptx ├── index.Rmd ├── index.html ├── logo_gallery.png └── ~$Talk_online_analytics_report.pptx /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/holtzy/data_analysis_website/70c6e09a16fe8cb13f42c6e3e369250f59c73c70/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This tiny repo is the result of a 10 minutes demo. It shows how to make a data analysis report a website: 2 | 3 | - Use R to perform some data analysis (data wrangling, stat, viz) 4 | - Wrap your findings in a R Markdown document 5 | - Use Github for version control 6 | - Use gh page to make it a website 7 | 8 | The result is here: 9 | https://holtzy.github.io/data_analysis_website/ 10 | 11 | The slides with step by step explanation are here: 12 | https://github.com/holtzy/data_analysis_website/blob/main/Talk_online_analytics_report.pdf 13 | 14 | 15 | ----------- 16 | 17 | Additional resources: 18 | 19 | - [pimp my rmd](https://holtzy.github.io/Pimp-my-rmd/): a set of trick and tips for better R Markdown reports 20 | - [epurate](https://github.com/holtzy/epuRate): a template to make your rmd report looking neat 21 | -------------------------------------------------------------------------------- /Talk_online_analytics_report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/holtzy/data_analysis_website/70c6e09a16fe8cb13f42c6e3e369250f59c73c70/Talk_online_analytics_report.pdf -------------------------------------------------------------------------------- /Talk_online_analytics_report.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/holtzy/data_analysis_website/70c6e09a16fe8cb13f42c6e3e369250f59c73c70/Talk_online_analytics_report.pptx -------------------------------------------------------------------------------- /index.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Gapminder analysis" 3 | author: "[Yan Holtz](https://github.com/holtzy)" 4 | date: "`r format(Sys.time(), '%d %B %Y')`" 5 | mail: "yan.holtz.data@gmail.com" 6 | linkedin: "yan-holtz-2477534a" 7 | twitter: "r_graph_gallery" 8 | github: "holtzy" 9 | home: "www.yan-holtz.com" 10 | # !!! You need to provide a logo image here !!! Or just delete the field for no logo 11 | logo: "logo_gallery.png" 12 | output: 13 | epuRate::epurate: 14 | toc: TRUE 15 | number_sections: FALSE 16 | code_folding: "show" 17 | --- 18 | 19 | 20 |

21 | 22 | 23 | ```{r setup, include=FALSE} 24 | knitr::opts_chunk$set(echo = TRUE) 25 | ``` 26 | 27 | 28 | ## Libraries 29 | *** 30 | 31 | Let's load some libraries needed 32 | ```{r, warning=FALSE, message=FALSE } 33 | # Libraries 34 | library(tidyverse) # includes ggplot2 35 | library(hrbrthemes) # better chart appearance 36 | library(viridis) # better color palette 37 | library(plotly) # interactive charts 38 | #library(gridExtra) 39 | 40 | # The dataset is provided in the gapminder library 41 | library(gapminder) 42 | ``` 43 | 44 | ## Data wrangling 45 | *** 46 | 47 | Let's keep data for 2007 only 48 | 49 | ```{r} 50 | data <- gapminder %>% filter(year=="2007") %>% select(-year) 51 | ``` 52 | 53 | 54 | ## Let's build a chart 55 | *** 56 | 57 | Build the chart with ggplot2, make it interactive with plotly. 58 | 59 | 60 | ```{r} 61 | # Interactive version 62 | p <- data %>% 63 | mutate(gdpPercap=round(gdpPercap,0)) %>% 64 | mutate(pop=round(pop/1000000,2)) %>% 65 | mutate(lifeExp=round(lifeExp,1)) %>% 66 | arrange(desc(pop)) %>% 67 | mutate(country = factor(country, country)) %>% 68 | mutate(text = paste("Country: ", country, "\nPopulation (M): ", pop, "\nLife Expectancy: ", lifeExp, "\nGdp per capita: ", gdpPercap, sep="")) %>% 69 | ggplot( aes(x=gdpPercap, y=lifeExp, size = pop, color = continent, text=text)) + 70 | geom_point(alpha=0.7) + 71 | scale_size(range = c(1.4, 19), name="Population (M)") + 72 | scale_color_viridis(discrete=TRUE, guide=FALSE) + 73 | theme_ipsum() + 74 | theme(legend.position="none") 75 | 76 | ggplotly(p, tooltip="text") 77 | ```` -------------------------------------------------------------------------------- /logo_gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/holtzy/data_analysis_website/70c6e09a16fe8cb13f42c6e3e369250f59c73c70/logo_gallery.png -------------------------------------------------------------------------------- /~$Talk_online_analytics_report.pptx: -------------------------------------------------------------------------------- 1 | Yan Holtz Yan Holtz --------------------------------------------------------------------------------