Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
datautils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bioinfo
datautils
Commits
917f6213
Commit
917f6213
authored
Sep 16, 2016
by
Holger Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added purr and removed plyr
parent
fd78419a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
36 deletions
+33
-36
R/core_commons.R
R/core_commons.R
+14
-36
R/ggplot_commons.R
R/ggplot_commons.R
+19
-0
No files found.
R/core_commons.R
View file @
917f6213
...
...
@@ -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
...
...
R/ggplot_commons.R
View file @
917f6213
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment