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
library(tidyverse) | |
theme_set(theme_minimal()) | |
roc <- iris %>% | |
gather(Metric, Value, -Species) %>% | |
mutate(Positive = Species == "virginica") %>% | |
group_by(Metric, Value) %>% | |
summarise(Positive = sum(Positive), | |
Negative = n() - sum(Positive)) %>% | |
arrange(-Value) %>% |
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
viridis_pal <- function(alpha=1) { | |
function(n) { | |
viridis(n, alpha) | |
} | |
} | |
scale_color_viridis <- function(..., alpha=1, discrete=TRUE) { | |
if (discrete) { | |
discrete_scale("colour", "viridis", viridis_pal(alpha), ...) |
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
# Input data | |
# plot.data - dataframe comprising one row per group (cluster); col1 = group name; cols 2-n = variable values | |
# axis.labels - names of axis labels if other than column names supplied via plot.data [Default = colnames(plot.data)[-1] | |
# | |
# Grid lines | |
# grid.min - value at which mininum grid line is plotted [Default = -0.5] | |
# grid.mid - value at which 'average' grid line is plotted [Default = 0] | |
# grid.max - value at which 'average' grid line is plotted [Default = 0.5] | |
# | |
# Plot centre |
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
#' --- | |
#' output: | |
#' html_document: | |
#' keep_md: TRUE | |
#' --- | |
#+ include = FALSE | |
library(dplyr) | |
#' Responses to [my |
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
#!/usr/bin/env r | |
# | |
# a simple example to update packages in /usr/local/lib/R/site-library | |
# parameters are easily adjustable | |
repos <- "http://cran.rstudio.com" | |
lib.loc <- "/usr/local/lib/R/site-library" | |
update.packages(repos=repos, ask=FALSE, lib.loc=lib.loc) |
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
## Curated stuff: | |
## * MetaCran: http://www.r-pkg.org/ | |
## * List of Packages gathered by Garret G.: https://github.com/rstudio/RStartHere | |
## * List of popular packages https://awesome-r.com/ | |
## * List of DataScience R tutorials https://github.com/ujjwalkarn/DataScienceR | |
## * List of machine elearning tutorials by subject: https://ujjwalkarn.github.io/Machine-Learning-Tutorials/ | |
## Reproducible package management for R: | |
install.packages("devtools") | |
install.packages("tidyverse") |