This file contains 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) | |
df <- tribble( | |
~Age, ~WeeklyWages, ~HoursWorkedPerWeek, | |
48, 500, 38, | |
50, 200, 38, | |
39, 200, 38, | |
56, 200, 40 | |
) | |
# Option 1: First column for variables and other columns for metrics |
This file contains 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) | |
economics %>% | |
ggplot(aes(x = date, y = unemploy)) + | |
geom_line(data = economics %>% filter(date < '1990-01-01'), color = "grey") + | |
geom_line(data = economics %>% filter(date < '2000-01-01') %>% filter(date > '1990-01-01'), color = "blue") + | |
geom_line(data = economics %>% filter(date >= '2000-01-01'), color = "grey") |
This file contains 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
# Usage example: | |
# excel_data_write("data/clean-data.xlsx", | |
# tibble( | |
# sheetName = c("months"), | |
# data = list(clean_data) | |
# ) | |
# ) | |
# excel_data_read("data/clean-data.xlsx", sheetName = "months") | |
excel_data_write = function(file, df) |
This file contains 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
# Datastudio formula | |
CASE | |
WHEN CAST(REGEXP_EXTRACT(Month, '^(\\d+)/') AS Number ) = YEAR(TODAY(), '%Y') AND CAST(REGEXP_EXTRACT(Month, '/(\\d+)/') AS Number ) = MONTH(TODAY(), '%m') THEN DAY(TODAY(), '%d') | |
WHEN REGEXP_CONTAINS(Month, '/(04|06|09|11)/') THEN 30 | |
WHEN REGEXP_CONTAINS(Month, '/02/') THEN 28 | |
ELSE 31 | |
END |
This file contains 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
// puppeteer-fetch-and-render-docker.js | |
// Fetch and render using an specific google chrome version | |
// We'll use appropiate zenika/alpine-chrome docker image. More information: https://github.com/Zenika/alpine-chrome | |
// Run: | |
// $ docker run -it --mount src="$(pwd)",target=/myproject,type=bind zenika/alpine-chrome:76-with-puppeteer /bin/sh | |
// /usr/src/app# cp /myproject/puppeteer-fetch-and-render.js . | |
// /usr/src/app# node puppeteer-fetch-and-render.js | |
// /usr/src/app# cp screenshot.png /myproject | |
// /usr/src/app# exit |
This file contains 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
if(!require(tidyverse)) install.packages("tidyverse") | |
if(!require(conflicted)) install.packages("conflicted") | |
tidyverse_update() | |
library(tidyverse) | |
library(MASS) | |
library(conflicted) | |
conflict_scout() | |
Cars93 %>% dplyr::select(Origin) |
This file contains 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
--- | |
title: "Trello to PDF" | |
author: "jrosell" | |
date: "2020-07-28" | |
output: pdf_document | |
--- | |
## R Markdown | |
This is an R Markdown document. It gets Trello cards and its attachments from specific list on a public board and build a PDF document from it. |
This file contains 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
if(!require(tidyverse)) install.packages("tidyverse") | |
if(!require(patchwork)) install.packages("patchwork") | |
library(patchwork) | |
library(tidyverse) | |
library(lubridate) | |
# Añadir anotaciones | |
ggplot(mpg, aes(displ, hwy)) + | |
geom_point(aes(color = class)) + | |
geom_smooth(se = FALSE) + labs( |
This file contains 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
--- | |
title: "Impuestos y sueldos por país en Europa" | |
author: "Jordi Rosell" | |
date: "2020-06-08" | |
output: | |
html_document: | |
df_print: paged | |
--- | |
```{r setup, include=FALSE} |
This file contains 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
if(!require(tidyverse)) install.packages("tidyverse") | |
if(!require(patchwork)) install.packages("patchwork") | |
if(!require(nycflights13)) install.packages('nycflights13') | |
if(!require(tidymodels)) install.packages("tidymodels") | |
if(!require(modelr)) install.packages("modelr") | |
library(tidymodels) | |
library(nycflights13) | |
library(patchwork) | |
library(tidyverse) | |
library(lubridate) |