library(dplyr) # gives mutate_if
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
p = ggplot(diamonds, aes(x = color, fill=cut(price, | |
breaks = quantile(price), | |
include.lowest=TRUE, | |
labels = c('Expensive', | |
'More expensive', | |
'Very expensive', | |
'Ridiculously expensive')))) + | |
geom_bar(position='fill') + | |
facet_wrap(~cut) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gapminder) | |
library(tidyverse) | |
mydata = gapminder | |
gapminder %>% | |
filter(year == 2007) %>% | |
ggplot(aes(y = lifeExp, x = continent)) + | |
geom_boxplot() + | |
geom_jitter(aes(size = pop/1000000, fill = lifeExp), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) # gives mutate_if | |
library(forcats) # gives fct_explicit_na | |
#example dataframe, a and c are factors, | |
#b is numeric, d is boolean (TRUE/FALSE) | |
mydata = data.frame( | |
a = c( 'Yes', 'No', NA), | |
b = c( 0.5, NA, 0.6), | |
c = c( 'No', NA, 'Yes'), | |
d = c( TRUE, NA, FALSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(tidyverse) | |
library(gapminder) | |
# User Interface | |
ui <- basicPage( | |
sliderInput("year", "Select year:", animate = TRUE, | |
min = 1952, max = 2007, value = 2007, | |
step = 5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(tidyverse) | |
library(gapminder) | |
# User Interface | |
ui <- basicPage( | |
plotOutput(outputId = "myplot") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rnaturalearth) | |
library(sf) | |
theme_set(theme_void()) | |
world_map = ne_countries(scale = "medium", returnclass = "sf") %>% | |
st_transform(crs = "+proj=moll") %>% | |
filter(sovereignt != "Antarctica") | |
healthyr_iso= c("GB", "EE", "GH") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
header-includes: | |
- \usepackage{float} | |
- \floatplacement{table}{!hb} | |
- \floatplacement{figure}{!hb} | |
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` | |
```{r message=FALSE, warning=FALSE} | |
library(tidyverse) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# R script to split up the recruitment PDF that we get from HR | |
# Riinu Pius 30/07/2020 | |
# Script figures out where each new application starts, extracts the candidates last name | |
# then creates a separate PDF for each candidate: Lastname.pdf | |
library(tidyverse) | |
library(pdftools) | |
pdf_filename = "Candidate report (n) Job Title vacancy 123456.pdf" | |
# Change to "\" if on Windows: |
OlderNewer