[R-sig-Geo] (no subject)

rpaolo1967 RP rpaolo1967 at gmail.com
Tue Dec 9 16:17:46 CET 2014


Hi everybody,



I apologize for this simple question. I’m running a code which, at each
step of a loop, generates a data frame similar to this one:



d <- rep(1:10, each = 6, len = 60)

a <- rep(0:5, each = 1, len = 60)

v <- rep(sort(runif(5, 30, 50), decreasing = T), each = 1, len = 60)

x <- data.frame(t(cbind(d,a,v)))



I want to create and save plots of the results, once data frames are
created. I’m using this code within the loop, after the creation of the
data frame:



# library(lattice)

svg("eraseMe.svg") # Format doesn’t matter, and name is iteratively created

xyplot(v ~ a | d, x, aspect = 5, type = "o", xlab = "a", ylab = "v")

update(trellis.last.object(),

    strip = strip.custom(strip.names = FALSE, strip.levels = i),

    par.strip.text = list(cex = 1.1))

dev.off()



where “i” is something as simple as



i <- as.numeric(c(1:10))



It works troublelessly on my laptop (under 32 bits Windows Vista), but I
get the following message when running in computers under ubuntu or 64 bits
Windows 7:



Error in !lattice.getStatus("current.plot.saved", prefix = prefix) :

  invalid argument type



Notwithstanding, when I simply copy and paste again the following code,
after getting the message, it works fine (but loop is interrupted).



svg("eraseMe.svg") # No matter the format

xyplot(v ~ a | d, x, aspect = 5, type = "o", xlab = "a", ylab = "v")

update(trellis.last.object(),

   strip = strip.custom(strip.names = FALSE, strip.levels = i),

   par.strip.text = list(cex = 1.1))

dev.off()



Any suggestion? Thanks a lot!!!!


Paolo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list