Skip to content

Instantly share code, notes, and snippets.

View llrs's full-sized avatar

Lluís Revilla llrs

View GitHub Profile
@jxtx
jxtx / bioc2018.md
Last active August 22, 2018 14:30
#bioC 2018 Conference Notes
@juliasilge
juliasilge / january_meta.R
Last active January 27, 2019 23:14
Views to answers on Stack Overflow questions
## this analysis assumes a dataframe `post_views` with columns:
## PostId
## CreationDate
## Tag
## AnswerCount
## ViewCount
library(tidyverse)
post_views %>%
``` r
library(Matrix)
alpha = 0.05
A <- rsparsematrix(1000, 1000, 0.1)
s <- as.data.frame(summary(A))
p <- abs(s$x) / sum(abs(s$x)) # probabilities proportional to abs(entry)
@rcastelo
rcastelo / depburden.R
Last active February 22, 2020 06:38
Functions to help identifying scarcely used R package dependencies representing a large installation burden
## this file contains 4 functions using several R and Bioconductor
## packages to help identifying scarcely used R package dependencies
## representing a large installation burden. it has been created
## upon the following discussion thread on the bioc-devel mailing list:
## https://stat.ethz.ch/pipermail/bioc-devel/2020-February/016146.html
##
## to use these functions you need to build a database of package
## information using the following lines:
##
## repos <- BiocManager::repositories()[c("BioCsoft", "CRAN")]
@jeroen
jeroen / cranscraper.R
Last active January 17, 2021 17:15
Fast scraping of package metadata using curl multi API
# Globals
repos <- 'https://cloud.r-project.org'
pkgdata <- available.packages(repos = repos)
pkgs <- row.names(pkgdata)
# On success
make_callback <- function(i, url){
function(res){
if(res$status == 200){
buf <- rawConnection(res$content)
@dpseidel
dpseidel / default_aes.md
Last active February 12, 2021 17:08
Default ggplot2 aesthetics table

Default ggplot2 aesthetics by geom.

geom alpha angle colour family fill fontface height hjust lineheight linetype shape size stroke vjust weight width xmax xmin ymax ymin
GeomAbline NA black 1 0.5
GeomAnnotationMap NA NA grey20 1 0.5
GeomArea NA NA grey20 1 0.5
GeomBar NA NA grey35 1 0.
# Setup----
library(rtweet)
source("~/R/Projects/environment_vars.R") # secrets
api_key <- Sys.getenv("TWITTER_API_KEY")
api_secret_key <- Sys.getenv("TWITTER_API_SECRET")
access_token <- Sys.getenv("TWITTER_ACCESS_TOKEN")
access_token_secret <- Sys.getenv("TWITTER_ACCESS_TOKEN_SECRET")
@moodymudskipper
moodymudskipper / invisible_attributes.R
Created April 4, 2022 16:29
invisible attributes
set_invisible_attr <- function(x, ...) {
x_chr <- as.character(substitute(x))
pf <- parent.frame()
if(bindingIsActive(x_chr, pf)) {
env <- environment(activeBindingFunction(x_chr, pf))
args <- list(...)
env$closure$attrs[names(args)] <- args
return(x)
}
@MichaelChirico
MichaelChirico / get_r_translation_status_for_revision.R
Created April 26, 2022 07:11
Summarize the state of translation for a snapshot of r-devel
#!/usr/local/bin/Rscript
library(potools)
suppressPackageStartupMessages(library(data.table))
script_wd = setwd("~/github/r-svn")
GIT_COMMIT = if (interactive()) readline('git commit: ') else commandArgs(TRUE)
setwd('src/library')
get_po_messages <- potools:::get_po_messages