-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.Rprofile
97 lines (94 loc) · 2.21 KB
/
.Rprofile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
## -*- mode: R; -*-
local({
r = getOption("repos")
r["CRAN"] = "http://cran.r-project.org/"
options(repos = r)
})
options(browserNLdisabled = TRUE)
options("digits.secs"=3)
options(stringsAsFactors=TRUE)
options(showWarnCalls=TRUE)
options(showErrorCalls=TRUE)
options(error=NULL)
options(warn=0)
options(max.print=500)
options(warnPartialMatchDollar = TRUE)
Sys.setenv(LANG = "en_US.UTF-8")
Sys.setlocale("LC_COLLATE", "en_US.UTF-8")
Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
library(assertthat)
library(testthat)
library(stringr)
library(sqldf)
library(MASS)
library(jsonlite)
library(data.table)
library(xlsx)
library(XML)
library(devtools)
library(magrittr)
library(reshape2)
library(tidyr)
library(lubridate)
library(plyr)
library(dplyr)
library(testit)
library(markdown)
library(knitr)
library(slidify)
library(fortunes)
library(ggplot2)
library(tikzDevice)
library(ascii)
options(asciiType="org")
library(xtable)
library(Hmisc)
library(log4r)
library(boot)
library(kernlab)
.First <- function() {
gcr <- new.env()
gcr$attach.unsafe <- attach
gcr$attach <- function(...) {
warning("NEVER USE ATTACH! Use `unsafe.attach` if you must.")
attach.unsafe(...)
}
gcr$require <- function(...) {
warning("Are you sure you wanted `require` instead of `library`?")
base::require(...)
}
gcr$lsnofun <- function(name = parent.frame()) {
obj <- ls(name = name)
obj[!sapply(obj, function(x) is.function(get(x)))]
}
gcr$recoveronerror <- function() {
options(error=recover)
}
gcr$recoveronerroroff <- function() {
options(error=NULL)
}
gcr$erroronwarn <- function() {
options(warn=2)
}
gcr$erroronwarnoff <- function() {
options(warn=0)
}
options(sqldf.driver = "SQLite")
gcr$printdf <- function(df) {
if (nrow(df) > 10) {
print(head(df, 5))
cat("---\n")
print(tail(df, 5))
} else {
print(df)
}
}
gcr$printlen <- function(len=500) {
options("max.print" = len)
}
gcr$hundred <- function(df, idx=0) {
df[idx:(idx+100),]
}
base::attach(gcr, name="gcr", warn.conflicts=FALSE)
}
fortune()