Prerequisites
This lesson assume that you have a relatively good understanding of R and of the Reference Class system for object-oriented programming in R. If this is not the case, work through the following lessons first:
Introduction
Conclusion
Object serialization and instantiation are important aspects of object-oriented programming. This lesson explained how to serialize objects to one or more CSV files. In practice, objects are also often serialized to a database (especially relational), binary object files, or XML structures.
Tutorial
The video tutorial demonstrates the constructs introduced in this lesson.
Errata
None collected yet. Let us know.
LS0tDQp0aXRsZTogIlNlcmlhbGl6aW5nIFIgUmVmZXJlbmNlIENsYXNzIE9iamVjdHMgdG8gQ1NWIg0KcGFyYW1zOg0KICBjYXRlZ29yeTogNg0KICBudW1iZXI6IDEyNA0KICB0aW1lOiA2MA0KICBsZXZlbDogaW50ZXJtZWRpYXRlDQogIHRhZ3M6ICJyLG9iamVjdHMsc2VyaWFsaXphdGlvbixyZWZlcmVuY2UgY2xhc3MiDQogIGRlc2NyaXB0aW9uOiAiVGhpcyBsZXNzb25zIGRlbW9uc3RyYXRlcyB0aHJvdWdoIG1hbnkgZXhhbXBsZXMgaG93DQogICAgICAgICAgICAgICAgdG8gc2VyaWFsaXplIHJlZmVyZW5jZSBjbGFzcyBvYmplY3RzIHRvIENTViBhbmQgaG93DQogICAgICAgICAgICAgICAgc3VjaCBvYmplY3RzIGNhbiBiZSByZWNvbnN0cnVjdGVkIGZyb20gQ1NWIGZpbGVzLg0KICAgICAgICAgICAgICAgIEV4cGxhaW5zIHRoZSBuZWVkIGZvciBjb250YWluZXIgY2xhc3NlcyBhbmQgdGhlIGNvbW1vbg0KICAgICAgICAgICAgICAgIG1ldGhvZHMgb2YgYWRkaW5nLCByZW1vdmluZywgZmluZGluZywgYW5kIGNvdW50aW5nDQogICAgICAgICAgICAgICAgb2JqZWN0cyBpbiBjb250YWluZXJzLiINCmRhdGU6ICI8c21hbGw+YHIgU3lzLkRhdGUoKWA8L3NtYWxsPiINCmF1dGhvcjogIjxzbWFsbD5NYXJ0aW4gU2NoZWRsYmF1ZXI8L3NtYWxsPiINCmVtYWlsOiAibS5zY2hl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