forked from ndejay/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.Rprofile
More file actions
43 lines (37 loc) · 1.1 KB
/
.Rprofile
File metadata and controls
43 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Do not automatically interpret strings as factors
options(stringsAsFactors = FALSE)
if (interactive()) {
# Resize output to terminal dimensions
suppressPackageStartupMessages(require('setwidth'))
# Load history
.First <- function() {
try(utils::loadhistory('~/.Rhistory'), silent = TRUE)
}
# Save history
.Last <- function() {
try(utils::savehistory('~/.Rhistory'), silent = TRUE)
}
# Source Bioconductor
.bioc <- function() {
source('http://bioconductor.org/biocLite.R')
}
# Detailed ls
.ls <- function() {
pretty <- function(x) {
ifelse(is.null(x), NA, prettyNum(x, big.mark = ',', scientific = FALSE))
}
extract <- function(symbol) {
var <- get(symbol)
list('symbol' = symbol,
'class' = class(var)[1],
'mode' = mode(var),
'type' = typeof(var),
'size' = pretty(object.size(var)),
'length' = pretty(length(var)),
'nrow' = pretty(nrow(var)),
'ncol' = pretty(ncol(var)))
}
as.data.frame(do.call(rbind, lapply(ls(pos = 1), extract)))
}
}
# vim: syntax=r