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

Finally introducing users with S3 classes

Our object-oriented system is almost finalized. We're only missing the User definition. In this case, we will use S3 to define the User class. The user_constructor() function takes an email and a Storage instance in storage to create a User instance. However, before it does, it checks that the email is valid with the valid_email() function defined below. After the user has been created, the get_wallets() method is called upon it to get the wallets associated to the user before it's sent back.

The valid_email() function simply receives a string which is supposed to be an email address, and checks whether at least one @ and one . symbol are contained within it. Of course, this is not a robust mechanism ...

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