Skip to content

Instantly share code, notes, and snippets.

View eduardszoecs's full-sized avatar

Eduard Szöcs eduardszoecs

View GitHub Profile
# function to do a dodged half-boxplot and jittered points next to each other
#
# data_in should be a data frame
# factor_col should be a bare column name (not a string)
# although it will work if that column is factor or a character type
# numeric_col is the y axis continuous variable
# offset is the width of the boxplots and jittered point cloud
#
# the basic approach is to draw a boxplot without the tails
# (e.g. only the interquartile range) and then use segments to add the
@hadley
hadley / shiny-oauth.r
Last active May 20, 2024 05:11
Sketch of shiny + oauth
library(shiny)
library(httr)
# OAuth setup --------------------------------------------------------
# Most OAuth applications require that you redirect to a fixed and known
# set of URLs. Many only allow you to redirect to a single URL: if this
# is the case for, you'll need to create an app for testing with a localhost
# url, and an app for your deployed app.
@calligross
calligross / app.R
Last active August 23, 2023 17:22
Shiny Cookie Based Authentication Example, please visit https://calligross.de/post/using-cookie-based-authentication-with-shiny/ for more information.
library(shiny)
library(shinyjs)
if (!dir.exists('www/')) {
dir.create('www')
}
download.file(
url = 'https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js',
destfile = 'www/js.cookie.js'
@sithjaisong
sithjaisong / plot.RCBD.layout.R
Created October 16, 2016 08:32
plot.RCBD.layout is the function used to generate layout of randomized complete block design of experiment
library(desplot)
library(agricolae)
library(RColorBrewer)
plot.RCBD.layout <- function(trt_name, num_block){
repeticion <- rep(num_block, length(trt_name))
RCBD <- design.rcbd(trt_name, r = repeticion, serie = 0)
@artemklevtsov
artemklevtsov / .gitlab-ci.yml
Last active January 12, 2024 04:14
Testing R package with GitLab CI (with code coverage)
variables:
CODECOV_TOKEN: "CODECOV_TOKEN_STRING"
_R_CHECK_CRAN_INCOMING_: "false"
_R_CHECK_FORCE_SUGGESTS_: "true"
APT_PKGS: "libcurl4-openssl-dev libssh2-1-dev libssl-dev libxml2-dev zlib1g-dev git"
before_script:
- apt-get update
- apt-get install -y --no-install-recommends ${APT_PKGS}
- apt-get install -y --no-install-recommends qpdf pandoc pandoc-citeproc
@philippmuench
philippmuench / Dockerfile
Last active April 10, 2021 22:46
packrat inside docker container
# add this line to your Dockerfile (you also need to install Rbase)
RUN R -e 'install.packages("packrat" , repos="http://cran.us.r-project.org"); packrat::restore()'
@ibartomeus
ibartomeus / clean_species
Last active January 23, 2017 08:34
Cleaning species taxonomy using taxize. I want to correct synonyms and typo's and drop incomplete cases.
#I have >1000 bees to check its name, so I want to automatize taxize for
# fixing misspellings when possible
# updating synonims to accepted names
# keeping ONLY accepted species (fully resolved at species level)
# this uses taxize > 0.7.6.9157 If you are using older version (e.g. what its now on CRAN) see the history of this file.
library(taxize)
library(dplyr)
#example: good, synomin, typo, unexisting, genus only.
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@abresler
abresler / tufte
Last active July 4, 2023 18:56
Recreating Edward Tufte's New York City Weather Visualization
library(dplyr)
library(tidyr)
library(magrittr)
library(ggplot2)
"http://academic.udayton.edu/kissock/http/Weather/gsod95-current/NYNEWYOR.txt" %>%
read.table() %>% data.frame %>% tbl_df -> data
names(data) <- c("month", "day", "year", "temp")
data %>%
group_by(year, month) %>%