forked from RConsortium/S7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaa.R
37 lines (27 loc) · 796 Bytes
/
aaa.R
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
`%||%` <- function(x, y) if (is.null(x)) y else x
new_function <- function(args = NULL,
body = NULL,
env = asNamespace("S7")) {
as.function.default(c(args, body) %||% list(NULL), env)
}
`append<-` <- function(x, after, value) {
if (missing(after))
c(x, value)
else
append(x, value, after = after)
}
`append1<-` <- function (x, value) {
stopifnot(is.list(x) || identical(mode(x), mode(value)))
x[[length(x) + 1L]] <- value
x
}
topNamespaceName <- function(env = parent.frame()) {
env <- topenv(env)
if (!isNamespace(env)) {
return() # print visible
}
as.character(getNamespaceName(env)) # unname
}
is_string <- function(x) {
identical(class(x), "character") && length(x) == 1L && !is.na(x) && x != ""
}