Skip to Content
R Programming By Example
book

R Programming By Example

by Omar Trejo Navarro
December 2017
Beginner to intermediate
470 pages
12h 29m
English
Packt Publishing
Content preview from R Programming By Example

Implementing cryptocurrency assets using S4 classes

Now, we will implement our next abstraction with the least number of dependencies, Asset. We will implement it using S4, and it only depends on TimeStamp. We define its class using the standard methods shown before, and its attributes include email to identify what user an asset belongs to, a timestamp to identify the asset at a point in time, a name to know what asset we're dealing with, a symbol to identify the asset type within our system, a total to record how much of that asset a user has, and an address to identify what wallet the asset belongs to (a user may have several wallets for the same type of asset):

setClass(    Class = "Asset",    representation = representation( email = "character", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Efficient R Programming

Efficient R Programming

Colin Gillespie, Robin Lovelace
R Programming

R Programming

Jared P. Lander

Publisher Resources

ISBN: 9781788292542Supplemental Content