Skip to content

Commit 76a3e21

Browse files
author
murrell
committed
final s/sapply/vapply changes for grid (thanks to Kurt for doing most of them!)
git-svn-id: https://svn.r-project.org/R/trunk@88298 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 749c8db commit 76a3e21

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/library/grid/R/grob.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ setChildren <- function(x, children) {
264264
}
265265
if (length(children)) {
266266
x$children <- children
267-
childNames <- sapply(children, childName)
267+
childNames <- vapply(children, childName, "")
268268
names(x$children) <- childNames
269269
x$childrenOrder <- childNames
270270
} else {
@@ -331,7 +331,7 @@ getName <- function(elt) {
331331

332332
getNames <- function() {
333333
dl <- grid.Call(C_getDisplayList)[1L:grid.Call(C_getDLindex)]
334-
names <- sapply(dl, getName)
334+
names <- vapply(dl, getName, "")
335335
names[nzchar(names)]
336336
}
337337

src/library/grid/R/ls.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ grobPathListing <- function(x, ...) {
756756

757757
# Tidy up the vpPath from grid.ls() to remove ROOT if it is there
758758
clean <- function(paths) {
759-
sapply(lapply(paths,
759+
vapply(lapply(paths,
760760
function(x) {
761761
pieces <- explode(x)
762762
if (length(pieces) && pieces[1] == "ROOT")
@@ -767,7 +767,8 @@ clean <- function(paths) {
767767
if (length(x))
768768
as.character(vpPath(x))
769769
else ""
770-
})
770+
},
771+
"")
771772
}
772773

773774
# Given a gPath, return complete grob paths that match from the display list

src/library/grid/R/viewport.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ depth.vpList <- function(x, ...) {
233233
depth.vpStack <- function(x, ...) {
234234
# Elements in the stack may be vpStacks or vpLists or vpTrees
235235
# so need to sum all the depths
236-
sum(sapply(x, depth, ..., simplify=TRUE))
236+
sum(vapply(x, depth, 0, ...))
237237
}
238238

239239
depth.vpTree <- function(x, ...) {

0 commit comments

Comments
 (0)