William Dunlap
2018-Nov-13 17:26 UTC
[R] saveRDS() and readRDS() Why? [solved, pretty much anyway)
It seems like copying the files corrupted them. How did you copy them (with R or cp or copy or ftp, etc.)? I don't see how this has anything to do with R. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 12, 2018 at 7:10 PM, p_connolly <p_connolly at slingshot.co.nz> wrote:> On 2018-11-13 12:55, William Dunlap wrote: > >> You wrote: >> ## On Windows 3.4.2 >> >> x <- airquality >>> saveRDS(x, file = "x.rds") >>> saveRDS(x, file = "y.rds") >>> >> >> Files x.rds and y.rds are identical in size but utterly different in >> content. >> >> Wow! Can you show us the results of >> x <- datasets::airquality >> saveRDS(x, file="x.rds") >> saveRDS(x, file="y.rds") >> tools::md5sum(c("x.rds", "y.rds")) >> dput(readBin("x.rds", what="raw", n=file.size("x.rds"))) >> dput(readBin("y.rds", what="raw", n=file.size("y.rds"))) >> >> (Copy and paste, as text, from the R session, so we can see the input >> and the output in context. >> > > If I do that on Linux or Windows, I get identical files. > > If I copy x.rds and y.rds from Windows to Linux (which is what I wish to > be able to do) using a shared folder between the Windows VirtualBox host to > the Linux guest, I get this: > > > x <- readRDS(file = "x.rds") >> > Error in readRDS(file = "x.rds") : error reading from connection > >> x <- readRDS(file = "y.rds") >> tools::md5sum(c("x.rds", "y.rds")) >> > x.rds y.rds > "5fef054848f39b4be02b7c54f1c71a20" "978a64d1dd342d16a381c9ca728d3665" > >> dput(readBin("x.rds", what="raw", n=file.size("x.rds"))) >> > as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00)) > >> dput(readBin("y.rds", what="raw", n=file.size("y.rds"))) >> > as.raw(c(0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x06, 0xe5, 0x97, 0x4b, 0x6c, 0x54, 0x55, 0x18, 0xc7, 0xcf, 0x9d, > 0x0e, 0x7d, 0x41, 0x71, 0x2c, 0x15, 0xac, 0x65, 0xa0, 0x94, 0xa9, > 0x80, 0x94, 0x52, 0xa1, 0x0b, 0xa9, 0x01, 0xa6, 0x58, 0xc4, 0xda, > 0x76, 0x68, 0x99, 0x42, 0x0b, 0x2d, 0xe8, 0x08, 0x45, 0x4d, 0xca, > 0x94, 0xb4, 0xc4, 0x07, 0x1b, 0x49, 0x5c, 0x10, 0x75, 0x65, 0xa2, > 0x26, 0x35, 0x71, 0xad, 0x3b, 0x16, 0x2e, 0x4c, 0x7c, 0x6b, 0xc2, > 0x82, 0xa8, 0x71, 0xa3, 0x71, 0x63, 0x7c, 0x2c, 0x74, 0x85, 0x2c, > 0x8c, 0x0b, 0xa3, 0x40, 0xfd, 0x7f, 0xf7, 0xfc, 0xff, 0xed, 0xcd, > 0x49, 0x59, 0xcf, 0xc2, 0x9b, 0xfc, 0xe6, 0xbb, 0xe7, 0x3b, 0xe7, > 0x7c, 0xaf, 0x73, 0xee, 0xdc, 0x73, 0xc7, 0xeb, 0x9d, 0x73, 0x29, > 0x57, 0x95, 0x4a, 0xbb, 0x54, 0x15, 0x6e, 0xab, 0xd6, 0xe0, 0xa7, > 0x1a, 0x34, 0x80, 0x79, 0xb0, 0x0d, 0xe4, 0xc0, 0x2a, 0xd0, 0x78, > 0xc9, 0xc5, 0xd7, 0x7a, 0xb0, 0x0e, 0xd8, 0xd8, 0x5a, 0xea, 0x6a, > 0x40, 0x06, 0xac, 0x04, 0xab, 0x6d, 0x2c, 0x65, 0x1b, 0xed, 0x6d, > 0x60, 0x5f, 0x44, 0x99, 0x06, 0xad, 0x36, 0x57, 0xd0, 0xe6, 0x0e, > 0x30, 0x07, 0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0x7e, 0xc7, 0x11, > 0x00, 0x00)) > >> >> > The issue is evidently with the shared folder. I've been doing that > (sharing the folder) for years and never encountered a problem. > > > >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com [1] >> >> On Mon, Nov 12, 2018 at 12:42 PM, p_connolly >> <p_connolly at slingshot.co.nz> wrote: >> >> On 2018-11-12 22:49, peter dalgaard wrote: >>> Er, where, what, how? I can't reproduce that, at least not on 3.5.1 >>> on MacOS: >>> >>> x <- airquality >>> saveRDS(x, file = "x.rds") >>> x <- NULL >>> x <- readRDS(file = "x.rds") >>> x >>> Ozone Solar.R Wind Temp Month Day >>> 1 41 190 7.4 67 5 1 >>> 2 36 118 8.0 72 5 2 >>> 3 12 149 12.6 74 5 3 >>> ... >>> >>> Looks fine to me. >>> >> >> It seems to work fine using the same installation to read as used for >> the save. >> But it's a different story if the save was done on a Windows >> installation and read on a Linux installation. >> >> ## On Windows 3.4.2 >> >> x <- airquality >>> saveRDS(x, file = "x.rds") >>> saveRDS(x, file = "y.rds") >>> >> >> Files x.rds and y.rds are identical in size but utterly different in >> content. >> >> ## On Linux 3.5.1 >> >> x <- readRDS(file = "x.rds") >>> >> Error in readRDS(file = "x.rds") : error reading from connection >> >> x <- readRDS(file = "y.rds") >>> head(x) >>> >> Ozone Solar.R Wind Temp Month Day >> 1 41 190 7.4 67 5 1 >> 2 36 118 8.0 72 5 2 >> 3 12 149 12.6 74 5 3 >> 4 18 313 11.5 62 5 4 >> 5 NA NA 14.3 56 5 5 >> 6 28 NA 14.9 66 5 6 >> >> It might just be the age of the Windows installation. I don't have >> much use for Windows, so I haven't had much inclination to install a >> newer version. >> >> YMMV >> >> ? >>> -pd >>> >>> On 12 Nov 2018, at 08:28 , Patrick Connolly >>>> <p_connolly at slingshot.co.nz> wrote: >>>> >>>> The solution was very simple. Don't use the same name for the rds >>>> file as used for the R object, viz a vie: >>>> >>>> saveRDS(x, file = "x.rds") >>>> and >>>> x <- readRDS(file = "x.rds") >>>> >>>> will not work; however >>>> >>>> saveRDS(x, file = "y.rds") >>>> and >>>> x <- readRDS(file = "y.rds") >>>> will work. >>>> >>>> An undocumented feature? >>>> >>>> Thanks to all who contributed. >>>> >>> >>> -- >>> Peter Dalgaard, Professor, >>> Center for Statistics, Copenhagen Business School >>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark >>> Phone: (+45)38153501 >>> Office: A 4.23 >>> Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com >>> >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help [2] >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html [3] >> and provide commented, minimal, self-contained, reproducible code. >> >> >> >> Links: >> ------ >> [1] http://tibco.com >> [2] https://stat.ethz.ch/mailman/listinfo/r-help >> [3] http://www.R-project.org/posting-guide.html >> >[[alternative HTML version deleted]]
p_connolly
2018-Nov-13 22:10 UTC
[R] saveRDS() and readRDS() Why? [solved, pretty much anyway)
This is getting more strange. I normally copy from the shared folder to the appropriate directory using Dolphin, the KDE file manager. If instead I use the standard bash cp command, no corruption happens -- at least with the limited testing I have done. There also seems to be no problem copying from Linux to Windows. I installed R-3.5.1 for Windows just to eliminate that possible issue. However, R has *something* to do with it because it was used to make the .rds file. Just how the relationship between the name of the R object and the name of the .rds file comes into it, I can't imagine. Thanks for the suggestion William. On 2018-11-14 06:26, William Dunlap wrote:> It seems like copying the files corrupted them. How did you copy them > (with R > or cp or copy or ftp, etc.)? I don't see how this has anything to do > with R. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com [1] > On Mon, Nov 12, 2018 at 7:10 PM, p_connolly > <p_connolly at slingshot.co.nz> wrote:[...]
William Dunlap
2018-Nov-13 22:22 UTC
[R] saveRDS() and readRDS() Why? [solved, pretty much anyway)
Perhaps you got bitten by Dolphin's non-modal dialogs, as described in https://userbase.kde.org/Dolphin/File_Management: Non Modal Dialogs When Moving, Copying or Deleting files/directories the dialog disappears even when the operation has not yet completed. A progress bar then appears in the bottom right of the screen, this then disappears also, if you want see the progress you need to click a small (i) information icon in the system tray. Warning New users who are not used to this way of working (and even experienced users) can get caught out by this, if you are Moving, Copying or Deleting large directories then you need to use the icon to monitor the progress of your operation. If you don't then any subsequent actions you do, may well use an incomplete file structure resulting in corrupted files. You have been warned! Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Nov 13, 2018 at 2:10 PM, p_connolly <p_connolly at slingshot.co.nz> wrote:> This is getting more strange. > > I normally copy from the shared folder to the appropriate directory using > Dolphin, the KDE file manager. If instead I use the standard bash cp > command, no corruption happens -- at least with the limited testing I have > done. There also seems to be no problem copying from Linux to Windows. I > installed R-3.5.1 for Windows just to eliminate that possible issue. > > However, R has *something* to do with it because it was used to make the > .rds file. Just how the relationship between the name of the R object and > the name of the .rds file comes into it, I can't imagine. > > Thanks for the suggestion William. > > > On 2018-11-14 06:26, William Dunlap wrote: > >> It seems like copying the files corrupted them. How did you copy them >> (with R >> or cp or copy or ftp, etc.)? I don't see how this has anything to do >> with R. >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com [1] >> On Mon, Nov 12, 2018 at 7:10 PM, p_connolly >> <p_connolly at slingshot.co.nz> wrote: >> > [...] > >[[alternative HTML version deleted]]