I want to do a zoom with recordPlot(). I have problems with lists. (R-2.0.1 patched 2004-11-30 , various linux). I have problems with RecordPlot class structure.
plot(1:10) saveP <- recordPlot() dev.off()
sx <- saveP[[1]][[2]][[2]] saveP[[1]][[2]][[2]] <- sx
Error in "[[<-"(`*tmp*`, 1, value = list(list(
.Primitive("plot.new")), list(.Primitive("plot
.window"), c(1, :
incompatible types
typeof(saveP[[1]][[2]][[2]])
[1] "double"
typeof(sx)
[1] "double"
But:
s1 <- saveP[[1]] s1[[2]][[2]] <- c(4,6) saveP[1] <- list(s1) saveP # zoom is OK
Also, I don't understand recursive indexing. With not modified saveP,
saveP[[c(1,2)]]
[[1]]
.Primitive("plot.window")
[[2]]
[1] 1 10
[[3]]
[1] 1 10
[[4]]
[1] ""
[[5]]
[1] NA
# OK
saveP[[c(1,2,2)]]
Error: recursive indexing failed at level 2 # why not [1] 1 10 ?? Jean Coursol