# Explore the differences between the .rds files printRDS <- function(infile, outfile) { x <- readRDS(infile) displaylist <- capture.output(print(x[[1]])) graphicsContext <- capture.output(print(x[[2]])) if (length(x) > 2) { gridContext <- capture.output(print(x[[3]])) } else { gridContext <- character() } writeLines(c(displaylist, graphicsContext, gridContext), outfile) } printRDS("R-recordplot_Windows.rds", "printRDS_Windows.txt") printRDS("R-recordplot_LinuxA.rds", "printRDS_LinuxA.txt") printRDS("R-recordplot_LinuxB.rds", "printRDS_LinuxB.txt") # Now 'diff' the .txt files # LinuxA vs LinuxB: # ONLY differences in locations of .so files (system dependent) # LinuxA vs Windows: # Differences in locations of .so files versus .dll files (system dependent) # ALSO differences in some blocks of graphicsContext, e.g., # < [289] 00 00 00 00 01 00 00 00 00 00 00 00 00 00 f0 3f 05 00 00 00 05 00 00 00 # --- # > [289] 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 05 00 00 00 # Other blocks different: [35449]..[35521] and [35809]..[35929] # Write the graphicsContext part of the .rds file to disk exportGraphicsContext <- function(infile, outfile) { x <- readRDS(infile) graphicsContext <- x[[2]] # as.vector() to strip attributes writeBin(as.vector(graphicsContext), outfile) } exportGraphicsContext("R-recordplot_Windows.rds", "graphicsContext_Windows.bin") exportGraphicsContext("R-recordplot_LinuxA.rds", "graphicsContext_LinuxA.bin") exportGraphicsContext("R-recordplot_LinuxB.rds", "graphicsContext_LinuxB.bin") # View the graphicsContext (from a .bin file) library(hexView) source("format.R") viewGraphicsContext <- function(infile, outfile) { sink(outfile) viewFormat(infile, GPar) # Skip the massive layout widths/heights/order/respect matrices cat("\n... skipping large layout information ...\n\n") viewFormat(infile, GPar2, offset=35428) sink() } # viewRaw("graphicsContext_Windows.bin") viewGraphicsContext("graphicsContext_Windows.bin", "graphicsContext_Windows.txt") viewGraphicsContext("graphicsContext_LinuxA.bin", "graphicsContext_LinuxA.txt") viewGraphicsContext("graphicsContext_LinuxB.bin", "graphicsContext_LinuxB.txt") # Now 'diff' the .txt files # LinuxA vs LinuxB: # NO DIFFERENCES # LinuxA vs Windows: # Mostly just rounding differences # EXCEPT for 'gamma' (1 on Windows, 0 on Linux)