[R] call a variable from outside of for loop

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Apr 23 14:40:59 CEST 2013


To be clear, the reproducible example should show us what the problem behavior is, and should be supplemented with some artificially-generated data that shows what you want to get. (We don't expect you to know the answer already.)

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Berend Hasselman <bhh at xs4all.nl> wrote:

>
>On 23-04-2013, at 13:21, eliza botto <eliza_botto at hotmail.com> wrote:
>
>> Dear useRs,
>> While using print command in "for" loop, i designated a variable
>being printed by "e". Although the output was shown inside the loop but
>when i tried to call the variable outside the loop it only gave the
>first row, where as it should have 35 rows as it showed inside loop.The
>command which i used in the loop is
>> e<-print(sum(abs(b-m[,i])))
>
>
>Give us a reproducible example of what you are trying to do.
>This doesn't make sense.
>
>Berend
>
>______________________________________________
>R-help at r-project.org mailing list
>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.



More information about the R-help mailing list