Skip to content

Instantly share code, notes, and snippets.

@iago-pssjd
iago-pssjd / voom_mode_r.py
Created May 11, 2023 15:56
Outliner of R code/extension files to be used with vim plugin VOoM
# File: voom_mode_r.py
# Last Modified: 2023-05-11
# Description: VOoM -- two-pane outliner plugin for Python-enabled Vim
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Iago Gine-Vazquez (iago.gin-vaz AT protonmail DOT com)
# License: CC0, see http://creativecommons.org/publicdomain/zero/1.0/
"""
VOoM markup mode for R headline markup.
@iago-pssjd
iago-pssjd / install_zotero.sh
Created May 17, 2022 10:44
Install zotero in a debian/linux system. It assumes each version is installed in /opt/zotero (so that this folder exists previously)
#! /bin/bash
tmp="/tmp/zotero"
platform="linux-$(uname -m)"
mkdir -p $tmp
@iago-pssjd
iago-pssjd / Firefox-history-with-R.r
Created April 14, 2022 09:34
Looking for all the visits to a certain webpage with R
# date_sql_firefox
# when looking at the history of firefox, only the last entry of a web is shown
# we may be interested in looking at other dates when we entered in such a web
url_of_int <- "https://www.r-bloggers.com/" # the webpage of interest
title_of_int <- "R-bloggers | R news and tutorials contributed by hundreds of R bloggers"
library("RSQLite") # or DBI? # load the library to open and using an SQLite database
@iago-pssjd
iago-pssjd / netCDF_test.r
Last active March 25, 2022 21:57
netCDF test with R for a job interview (1st part)
library(curl)
url = "ftp://.../tas_201711.nc"
curl_download(url = url, destfile = "/tmp/tas_201711.nc")
# Write a simple R script that
## 1. reads the netcdf file
as.mon <- function(posixlt){
posixlt <- unclass(posixlt)
@iago-pssjd
iago-pssjd / tidytuesday-2022-01-25.r
Last active January 25, 2022 09:56
Code for week 4 #TidyTuesday 2022 (polygons, section 3.1 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2022-01-25')
tuesdata <- tidytuesdayR::tt_load(2022, week = 4)
@iago-pssjd
iago-pssjd / tidytuesday-2022-01-18.r
Created January 18, 2022 10:38
Code for week 3 #TidyTuesday 2022 (scatterplot, section 3.1 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2022-01-18')
tuesdata <- tidytuesdayR::tt_load(2022, week = 3)
@iago-pssjd
iago-pssjd / tidytuesday-2022-01-11.r
Created January 14, 2022 15:16
Code for week 2 #TidyTuesday 2022 (line plot, section 3.1 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2022-01-11')
tuesdata <- tidytuesdayR::tt_load(2022, week = 2)
@iago-pssjd
iago-pssjd / tidytuesday-2021-12-21.r
Last active January 14, 2022 12:56
Code for week 52 #TidyTuesday 2021 (bar chart, section 3.1 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2021-12-21')
tuesdata <- tidytuesdayR::tt_load(2021, week = 52)
@iago-pssjd
iago-pssjd / tidytuesday-2021-12-14.r
Created January 14, 2022 11:39
Code for week 51 #TidyTuesday 2021 (area plot, section 3.1 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2021-12-14')
tuesdata <- tidytuesdayR::tt_load(2021, week = 51)
@iago-pssjd
iago-pssjd / tidytuesday-2021-12-07.r
Last active December 28, 2021 15:37
Code for week 50 #TidyTuesday 2021 (section 2.7 and 2.8 of ggplot2: Elegant Graphics for Data Analysis)
# Get the Data
# Read in with tidytuesdayR package
# Install from CRAN via: install.packages("tidytuesdayR")
# This loads the readme and all the datasets for the week of interest
# Either ISO-8601 date or year/week works!
tuesdata <- tidytuesdayR::tt_load('2021-12-07')
tuesdata <- tidytuesdayR::tt_load(2021, week = 50)