Skip to content

How top print intermediate values from inside a function?

3 messages · Ravi Varadhan, Peter Dalgaard, Pauline Gu

#
Hi:

I tried both "print(mh.new)" and "cat(mh.new)", but the results are 
displayed only after all the computations inside the function are 
completed.  Is there a way to display the intermediate variable 
immediately after it is evaluated?

thanks again,
Ravi.

----- Original Message -----
From: rossini at blindglobe.net (A.J. Rossini)
Date: Monday, November 25, 2002 5:15 pm
Subject: Re: [R] How top print intermediate values from inside a 
function?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Ravi Varadhan <rvaradha at jhsph.edu> writes:
Windows, right? There's a checkbox for "buffered output" or something
like that in the menus. Uncheck it.
#
Dear R experts,

Is there any function in R that I can calculate the permutation lists?  I 
would like to know if there is any generic one for finding all the 
permutation of n choose k?

For example:

perms <- list(1:2)
perms <- add.ttt(3:4, perms)
should give me
 > perms
[[1]]
[1] 3 4 1 2

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

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

and perms <- add.ttt(5:6, perms)
should give me:
[[1]]
[1] 5 6 3 4 1 2

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

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

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

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

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

[[7]]
[1] 5 3 6 1 4 2

[[8]]
[1] 5 3 1 6 4 2

[[9]]
[1] 5 3 1 4 6 2

[[10]]
[1] 5 3 1 4 2 6

[[11]]
[1] 5 6 3 1 2 4

[[12]]
[1] 5 3 6 1 2 4

[[13]]
[1] 5 3 1 6 2 4

[[14]]
[1] 5 3 1 2 6 4

[[15]]
[1] 5 3 1 2 4 6


This example is just for those with k=2.  How would I calculate those for 
any k?

Thanks in advance for your help.

Pauline

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._