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" 
<traxpla...@gmail.com> wrote:
>Some mistake:
>
>> I expect this output:
>
>[1] 100
>Martin
>Saldo is: 100
>
>but I get
>
>[1] 0
>Martn
>Saldo is: 0
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to