[R] add variable in for loop

pgseye prseye at gmail.com
Sat Mar 28 00:15:34 CET 2009


I'm learning to write some basic functions in R. For some data I have I'd
like to be able to add a variable to itself after each iteration in a for
loop to obtain a grandtotal for that variable so I can calculate a mean.

	for (i in 1:80){

	#print (total/80)

In perl there's an assignment operator variable+=variable2. Is there
anything like this in R to do as illustrated in the code above.

thanks a lot,

View this message in context: http://www.nabble.com/add-variable-in-for-loop-tp22751641p22751641.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list