Commit 917f6213 authored by Holger Brandl's avatar Holger Brandl

added purr and removed plyr

parent fd78419a
......@@ -30,27 +30,6 @@ options(gsubfn.engine = "R")
########################################################################################################################
## automatic package installation
require_auto <- function(x){
warning("require_auto is deprecated, use load_pack() instead")
x <- as.character(substitute(x))
if(isTRUE(x %in% .packages(all.available=TRUE))) {
eval(parse(text=paste("require(", x, ", quietly=T)", sep="")))
} else {
# update.packages(ask=F) # update dependencies, if any.
eval(parse(text=paste("install.packages('", x, "')", sep="")))
}
if(isTRUE(x %in% .packages(all.available=TRUE))) {
eval(parse(text=paste("require(", x, ", quietly=T)", sep="")))
} else {
source("http://bioconductor.org/biocLite.R")
# biocLite(character(), ask=FALSE) # update dependencies, if any.
eval(parse(text=paste("biocLite('", x, "', ask=FALSE)", sep="")))
eval(parse(text=paste("require(", x, ", quietly=T)", sep="")))
}
}
## externalized installer to also allow for installation without loading
install_package <- function(x){
......@@ -79,16 +58,6 @@ load_pack <- function(x, warn_conflicts=T){
eval(parse(text=paste("library(", x, ", quietly=T, warn.conflicts=", warn_conflicts, ")", sep="")))
}
loadpack <- function(x, warn_conflicts=T){
warning("DEPRECATED Use load_pack() instead")
x <- as.character(substitute(x));
install_package(x)
## load it using a library function so that load_pack errors if package is still not ins
eval(parse(text=paste("library(", x, ", quietly=T, warn.conflicts=", warn_conflicts, ")", sep="")))
}
check_version = function(pkg_name, min_version) {
cur_version = packageVersion(pkg_name)
......@@ -100,20 +69,24 @@ check_version = function(pkg_name, min_version) {
########################################################################################################################
## load core packages
load_pack(plyr)
load_pack(stringr)
load_pack(reshape2)
#load_pack(plyr)
#load_pack(reshape2)
#load_pack(reshape2, quietly=T, warn_conflicts=F)
## load on purpose after plyr
load_pack(dplyr, warn_conflicts=F)
load_pack(magrittr, warn_conflicts=F)
load_pack(tidyr, warn_conflicts=F)
load_pack(stringr)
load_pack(purrr)
load_pack(readr)
load_pack(readxl) ## supress differring build number
## needed for caching
load_pack(digest)
load_pack(readr)
suppressWarnings(load_pack(readxl)) ## supress differring build number
#suppressWarnings(load_pack(readxl)) ## supress differring build number
#load_pack(readxl) ## supress differring build number
......@@ -151,6 +124,11 @@ pp <- function(dat) page(dat, method = "print")
as.df <- function(dt) as.data.frame(dt)
install_package("tibble")
## restore pre-tibble-v1.2 naming to creating data-frame in place
frame_data = function(...) tibble::tribble(...)
########################################################################################################################
#### data.frame manipulation
......
......@@ -152,6 +152,25 @@ makePcaPlot <- function(x = getData(), group = NA, items=rownames(x), title = ""
# makePcaPlot(getData(30,4,2,distort = 0.7))
########################################################################################################################
### ggpairs
#load_pack(GGally)
#ggpairs(tips, mapping = aes(color = sex), columns = c("total_bill", "time", "tip"))
gp_alpha <- function(data, mapping, ...) {
ggplot(data = data, mapping=mapping) + geom_point(alpha = 0.1)
}
gp_bin2d <- function(data, mapping, ..., low = "#10721C", high = "#F11D05") {
ggplot(data = data, mapping = mapping) +
geom_bin2d(...) +
scale_fill_gradient(low = low, high = high)
}
#qModelStats %>% ungroup() %>% select(-ensembl_gene_id) %>% ggpairs(lower=list(continuous=gp_bin2d), title="plot score as regressor")
########################################################################################################################
### Base-plot utils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment