在Javascript中删除运算符

时间:2016-03-25 18:11:12

标签: javascript

enter image description here     作为代码,如果我使用删除操作符并删除me.name     引用第一个指针的指针。然后安装     name.first它的未定义但它不应该像名字一样分配     一个分离的记忆空间..请解释一下?

library(png)
library(ggplot2)
library(grid)

# Get image
img <- readPNG(system.file("img", "Rlogo.png", package="png"))

# Grab online image
url <- "https://www.rstudio.com/wp-content/uploads/2014/06/RStudio-Ball.png"
destfile <- "myfile.png"
r_studio <- download.file(url, destfile, mode="wb")
r_studio <- readPNG("myfile.png")

#Create the object `img`: your example code above does not do this
img <- r_studio

# Put images in list    
image_list <- list(img, r_studio)

# Plot
p = ggplot(mtcars, aes(mpg, disp, colour = factor(vs))) + 
  geom_point() +
  theme(legend.key.size = unit(1, "cm"))

# Get ggplot grob
gt = ggplotGrob(p)
grid.newpage()
grid.draw(gt)

# Search using regular expressions
Tree = as.character(current.vpTree())
pos = gregexpr("\\[key.*?\\]", Tree)
match = unlist(regmatches(Tree, pos))

match = gsub("^\\[(key.*?)\\]$", "\\1", match) # remove square brackets
match = match[!grepl("bg", match)]  # removes matches containing bg

# Loop through image list. Change the legend keys to images
for(i in 1:2){
 downViewport(match[i])
 grid.rect(gp=gpar(col = NA, fill = "white"))
 grid.raster(image_list[[i]], interpolate=FALSE)
 upViewport(0) 
}

0 个答案:

没有答案