Re: [R] How to print output during for loops?

From: ronggui <042045003_at_fudan.edu.cn>
Date: Sat 29 Oct 2005 - 21:16:30 EST


> for (i in 1:5) {

+ cat(paste(i,"\n"))
+ }
1
2
3
4
5
> for (i in 1:5) {

+ print(i)
+ }

[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
	

>Hi,
>
>I was wondering, if it is possible to print out the
>values of variables while you are in a for/while loop?
>Like this for example:
>
>for (i in 1:5) {
> i
>}
>
>So what I want is this as output in the console:
>>1
>>2
>>3
>>4
>>5
>
>Thanks in advance,
>
>Martin
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

2005-10-29



Deparment of Sociology
Fudan University

My new mail addres is ronggui.huang@gmail.com Blog:http://sociology.yculblog.com



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Oct 29 21:32:35 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:53 EST