Skip to content

Instantly share code, notes, and snippets.

View jmbarbone's full-sized avatar

Jordan Mark Barbone jmbarbone

View GitHub Profile
@jmclawson
jmclawson / collapse_rows.R
Last active September 12, 2024 17:35
something like "collapse rows" for gt
collapse_rows <- function(df_g, col, lookleft = TRUE){
col_num <- grep(deparse(substitute(col)), colnames(df_g$`_data`))
collapse_style <- css(visibility = "hidden",
border_top = "0px")
test_rows <- function(x) ifelse(is.na(x == lag(x)), FALSE, x == lag(x))
if(col_num > 1 & lookleft) {
col_left <- as.name(colnames(df_g$`_data`)[col_num - 1])
@moodymudskipper
moodymudskipper / subset_to_end.R
Created December 18, 2021 18:40
subset to end
`[` <- function(x, ...) {
base::`[`(x, ...)
}
makeActiveBinding(".I", function() {
sc <- sys.calls()
fr <- which(vapply(sc, \(x) capture.output(x)[1], character(1)) == "base::`[`(x, ...)")
fr <- fr[length(fr)]
sf <- sys.frames()[[fr-1]]
x <- eval(quote(x), sf)
@jcheng5
jcheng5 / filters.R
Last active September 12, 2024 22:48
library(shiny)
columnFilterUI <- function(id) {
ns <- NS(id)
uiOutput(ns("filter_container"))
}
columnFilter <- function(input, output, session, df, col_num, choice_filter) {
# This renders a selectInput and only re-renders when the selected data
# frame changes. (i.e. it doesn't re-render when filters change state.)
@ellisvalentiner
ellisvalentiner / bitbucket-pipelines.yml
Created October 12, 2016 21:04
yaml to build R package for bitbucket pipelines continuous integration
image: rocker/hadleyverse:latest
pipelines:
default:
- step:
script:
- cd /opt/atlassian/pipelines/agent/build
- Rscript -e 'devtools::install_deps(".", dependencies=TRUE, upgrade=FALSE)'
- Rscript -e 'devtools::build()'
- Rscript -e 'devtools::install(upgrade_dependencies = FALSE)'
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete