Last active
October 17, 2016 16:58
-
-
Save jirilukavsky/ff17fa1086f3187a3f2fae99245a589d to your computer and use it in GitHub Desktop.
Useful functions for R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dplyr ==================== | |
# descriptive stats per group, some columns omitted | |
selvars <- c(2, 3, 4, 5, 8, 9, 13) | |
d %>% do(describe(.[["varname"]])[, selvars]) | |
# ggplot2 ================== | |
# set default theme to bw | |
theme_set(theme_bw()) | |
# other ==================== | |
# export to clipboard | |
cb <- function(data, echo=F, rownames=F) { | |
clipb <- pipe("pbcopy", "w") | |
write.table(data, file=clipb, row.names=rownames, dec=",", sep="\t") | |
close(clipb) | |
if (echo) return(data) | |
} | |
# rmarkdown | |
# current date in reports (by @fidadoma) | |
date: '`r format(Sys.time(), "%d %B, %Y")`' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment