[R] Turning of source echo

darnold dwarnold45 at suddenlink.net
Sat Aug 25 21:54:34 CEST 2012


Berend,

Yes, I did ask this question on RStudio help page. Josh suggested that I try
to find some package that pops  up a window with the results I want. Anyone
know how to do that? Is there a package or a tutorial that will instruct me
as to how to do that?

Here is my code:

BAGA <- c(10,20,20,30,30,30,30,40,
          40,40,40,50,50,50,50,50,
          60,60,60,60,60,70,70,70,
          70,80,80,80,90,90,100)

BAGB <- c(10,10,10,10,10,20,20,20,
           20,30,30,30,40,40,50,60,
           70,70,80,80,80,90,90,90,
           90,100,100,100,100,100)

A <- sample(c(1,2),1)

if (A==1) {
  B <- BAGA[sample(length(BAGA),1)]
} else {
  B <- BAGB[sample(length(BAGB),1)]
}

cat("X = ", B, ".\n",sep="")
if (A==1) cat("The voucher is from Bag A.\n")
if (A==2) cat("The voucher is from Bag B.\n")

What I'd like to do is find a way to repeat this code N number of times,
with the student hitting the enter key or the space bar to get the next
repetition. Each time, I want a result similar to the following to come up,
but I don't want that source message to come up.

> source('~/.active-rstudio-document')
X = 30.
The voucher is from Bag A.

Each time
Anyone have any suggestions?

Thanks.

David.



--
View this message in context: http://r.789695.n4.nabble.com/Turning-of-source-echo-tp4641278p4641317.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list