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
sudo apt-get install neovim | |
mkdir ~/.config/nvim/ | |
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
curl https://gist.githubusercontent.com/cimentadaj/4cca2b0031922878f200c127190f1a33/raw/41d7be6452208b858fd302be9ca6ba32b71db426/init.vim >> ~/.config/nvim/init.vim |
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
"" Plugins | |
call plug#begin('~/.config/nvim/autoload/plugged') | |
Plug 'rakr/vim-one' " vim-one color theme | |
Plug 'scrooloose/nerdtree' " side bar file tree | |
Plug 'itchyny/lightline.vim' " side bar file tree | |
Plug 'jreybert/vimagit' " git client | |
Plug 'tpope/vim-fugitive' " git client | |
Plug 'airblade/vim-gitgutter' " shows git changes in gutter | |
Plug 'easymotion/vim-easymotion' " go to anyword quickly \\w, \\e, \\b | |
Plug 'KKPMW/vim-sendtowindow' " send comando to REPL |
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
## DO NOT DELETE ME. I am linked to an automatic weekly process that sources me. | |
## If you UPDATE ME, remember to change me at the `pkgdown` Github actions workflow file for the R package `tidyflow` | |
# This function does pretty much the same thing as the equivalent pkgdown function. | |
# But on top of it, it copies all PDF files from the presentations from inside `vignettes` | |
# to the articles folder inside the website, to allow to cross-reference pdf files | |
# inside the website. | |
# However, to avoid more internal dependencies of `pkgdown`, I removed the part that creates the gh-pages branch | |
# fom the code. If you delete gh-pages, this function won't create it. |
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
#!/bin/bash | |
MSG="use 'git commit --no-verify' to override this check" | |
files=$(ls -d vignettes/* | grep -Ei '\.orig$') | |
for fl in $files; do | |
# Remove .orig from the vignette files | |
rmd=$(echo $fl | sed 's/.orig//') | |
# Remove .Rmd to get the raw file name | |
vignettefile=$(echo $rmd | sed 's/.Rmd//') |
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(tibble) | |
library(dplyr) | |
nombre <- c("barbastro", "teruel", "fuerteventura", "la palma", "talavera", "cuenca", "placencia", "la rioja", "burgos", "soria", "avila") | |
puntuacion <- c(6.61, 6.22, 6.65, 7.14, 6.72, 7.01, 7.04, 7.17, 7.21, 7.06, 7.35) | |
plazas <- c(16, 13, 5, 3, 14, 7, 8, 19, 5, 4, 4) | |
dt <- data.frame( | |
nombre = nombre, | |
puntuacion = puntuacion, |
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(rethinking) | |
data(reedfrogs) | |
d <- reedfrogs | |
d$tank <- 1:nrow(d) | |
dat <- list( | |
S = d$surv, | |
N = d$density, |
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
--- | |
title: "Corona Survey Tracker" | |
output: flexdashboard::flex_dashboard | |
runtime: shiny | |
--- | |
Column {.sidebar} | |
----------------------------------------------------------------------- | |
```{r} |
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(eurostat) | |
library(dplyr) | |
res <- get_eurostat("demo_r_pjangroup") | |
## Example for NUTS1: UKB | |
uk_match <- "UK[A-Z]{1}$" | |
## Example for NUTS2: ITAC12 | |
ita_match <- "IT[A-Z][0-9]{1,2}" | |
## Example for NUTS1: either DE3 or DEA |
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(essurvey) | |
library(dplyr) | |
library(purrr) | |
## This works for the UK, where PhD is coded as `1` whereas | |
## in other countries PhD is coded as the maximum level | |
reverse_coding <- function(x, na_vals) { | |
## Find out the maximum + 1 to subtract that from the vector | |
## to reverse it | |
max_val <- max(setdiff(x, na_vals), na.rm = TRUE) + 1 |
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(recipes) | |
library(parsnip) | |
library(workflows) | |
spline_cars <- | |
recipe(mpg ~ ., data = mtcars) %>% | |
step_ns(disp, deg_free = 10) | |
bayes_lm <- | |
linear_reg() %>% |
NewerOlder