[R] Help with first S3-class
jdnewmil at dcn.davis.ca.us
Wed Jan 3 08:36:16 CET 2018
Function arguments are not pass-by-reference... they are pass-by-value. You need to return the altered object to the caller when you are done messing with it.
Note that R is a data processing language... your example will not scale to real world use cases because you make no use of vectorization to handle multiple accounts. It is better to focus on the functional aspect of computing and let the objects carry the results until you have a chance to summarize or plot them. Study the "lm" function and associated print and plot methods.
Sent from my phone. Please excuse my brevity.
On January 2, 2018 4:37:01 PM PST, "Martin Møller Skarbiniks Pedersen" <traxplayer at gmail.com> wrote:
>> I expect this output:
>Saldo is: 100
>but I get
>Saldo is: 0
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help