Skip to content

Instantly share code, notes, and snippets.

View ashishdamania's full-sized avatar
🎯
Focusing

Ashish Damania ashishdamania

🎯
Focusing
  • MD Anderson
View GitHub Profile
@benmarwick
benmarwick / rotate-axis-labels-ggplot2.R
Last active March 30, 2024 08:00
I can never remember how to rotate the x-axis labels with ggplot2: theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
# Adapted from https://stackoverflow.com/a/7267364/1036500 by Andrie de Vries
# This is it: theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
library(ggplot2)
td <- expand.grid(
hjust=c(0, 0.5, 1),
vjust=c(0, 0.5, 1),
angle=c(0, 45, 90),
@graceavery
graceavery / harryPotterAliases
Last active May 10, 2023 02:51
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@johanez
johanez / rf_parallel.R
Created May 22, 2015 08:25
randomForest CV based variable selection (rfcv) wrapper, that returns the best rf_model and important variable names.
# paralell RF with foreach
# careful: no confusion, err.rate, mse and rsq components
# (as well as the corresponding components in the test compnent, if exist)
rf_parallel <- function(x, y, ntree=500, ncore=4, ...){
require(foreach)
require(randomForest)
# optional parallel backend
if (ncore > 1) {
require(doParallel)
registerDoParallel(ncore)
@casallas
casallas / multinomial.md
Last active January 14, 2023 22:12
R Packages/Functions/Resources for multinomial (ordinal & categorical) regression
Package Ordinal Multinomial Partial proportional odds Scale Effects Random Effects
nnet no multinom N/A N/A No
MASS polr No No No No
ordinal clm/clm2 all X's in nominal (may not converge) offending X's in nominal via scale clmm/clmm2
VGAM yes ? ? ? No
MCMCglmm yes ? ? ? ?
Mixcat yes ? ? npmlt
mlogit ? mlogit N/A N/