[R-pkg-devel] Warning about "serialize/load".

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Mon Jul 15 09:23:46 CEST 2019


On 7/15/19 2:06 AM, Travers Ching wrote:
> I think the major change was saving of alt-rep objects efficiently.
> Example save(1:1e8, file=...) is very efficient.
>
> I'm not sure if that is all that changed it, but I couldn't find
> documentation on the differences.

Yes, format version 3 provides custom serialization for altrep objects, 
so that it can e.g. serialize efficiently integer sequences. In 
addition, it keeps record of the current native encoding when 
serializing strings, so that it can convert strings with unflagged 
encoding when de-serializing them with different native encoding. So for 
example if a string with current native encoding X (not being latin1, 
and indeed not UTF-8) on Windows gets serialized, and then de-serialized 
on Linux running UTF-8 as current native encoding, it would be converted 
to UTF-8. In previous versions, it would be misinterpreted.

Best
Tomas

>
> For maximum compatibility in a package, personally I would use version 2.
>
>
> On Sun, Jul 14, 2019 at 4:52 PM Rolf Turner <r.turner using auckland.ac.nz> wrote:
>
>> In a package (say "clyde") that I am building I save a number of
>> datasets in clyde/data via something like:
>>
>> save(melvin,file="~/<whatever>/clyde/data/melvin.rda")
>>
>> When I build "clyde" I now get warnings like unto:
>>
>>> uWARNING: Added dependency on R >= 3.5.0 because serialized objects in
>>> serialize/load version 3 cannot be read in older versions of R.
>>> File(s) containing such objects: 'clyde/data/melvin.rda'
>> If I put the argument "version=2" into my save() call, the warnings go
>> away.
>>
>> What are the implications of this?
>>
>> What are the consequences/what is the downside of setting version=2?
>>
>> What are the consequences/what is the downside of adding the dependency
>> on R >= 3.5.0 into my DESCRIPTION file?
>>
>> Who gets shafted by each of these two possibilities?
>>
>> Which is recommended?
>>
>> Grateful for any pearls of wisdom.
>>
>> cheers,
>>
>> Rolf Turner
>>
>> --
>> Honorary Research Fellow
>> Department of Statistics
>> University of Auckland
>> Phone: +64-9-373-7599 ext. 88276
>>
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list