You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/aaa-.r
-40
Original file line number
Diff line number
Diff line change
@@ -12,43 +12,3 @@ NULL
12
12
#' @keywords internal
13
13
#' @name ggplot2-ggproto
14
14
NULL
15
-
16
-
# Fast data.frame constructor and indexing
17
-
# No checking, recycling etc. unless asked for
18
-
new_data_frame<-function(x=list(), n=NULL) {
19
-
if (length(x) !=0&& is.null(names(x))) stop("Elements must be named", call.=FALSE)
20
-
lengths<- vapply(x, length, integer(1))
21
-
if (is.null(n)) {
22
-
n<-if (length(x) ==0) 0else max(lengths)
23
-
}
24
-
for (iin seq_along(x)) {
25
-
if (lengths[i] ==n) next
26
-
if (lengths[i] !=1) stop("Elements must equal the number of rows or 1", call.=FALSE)
27
-
x[[i]] <- rep(x[[i]], n)
28
-
}
29
-
30
-
class(x) <-"data.frame"
31
-
32
-
attr(x, "row.names") <- .set_row_names(n)
33
-
x
34
-
}
35
-
36
-
data_frame<-function(...) {
37
-
new_data_frame(list(...))
38
-
}
39
-
40
-
data.frame<-function(...) {
41
-
stop('Please use `data_frame()` or `new_data_frame()` instead of `data.frame()` for better performance. See the vignette "ggplot2 internal programming guidelines" for details.', call.=FALSE)
if (length(x) !=0&& is.null(names(x))) stop("Elements must be named", call.=FALSE)
5
+
lengths<- vapply(x, length, integer(1))
6
+
if (is.null(n)) {
7
+
n<-if (length(x) ==0) 0else max(lengths)
8
+
}
9
+
for (iin seq_along(x)) {
10
+
if (lengths[i] ==n) next
11
+
if (lengths[i] !=1) stop("Elements must equal the number of rows or 1", call.=FALSE)
12
+
x[[i]] <- rep(x[[i]], n)
13
+
}
14
+
15
+
class(x) <-"data.frame"
16
+
17
+
attr(x, "row.names") <- .set_row_names(n)
18
+
x
19
+
}
20
+
21
+
data_frame<-function(...) {
22
+
new_data_frame(list(...))
23
+
}
24
+
25
+
data.frame<-function(...) {
26
+
stop('Please use `data_frame()` or `new_data_frame()` instead of `data.frame()` for better performance. See the vignette "ggplot2 internal programming guidelines" for details.', call.=FALSE)
stop('Please use `modify_list()` instead of `modifyList()` for better performance. See the vignette "ggplot2 internal programming guidelines" for details.', call.=FALSE)
0 commit comments