[R] Turning of source echo
David L Carlson
dcarlson at tamu.edu
Sat Aug 25 23:14:35 CEST 2012
This is not an RStudio issue. The RConsole echoes commands and then the
output. If you want to open a window to display the output of a command, you
might look at package tcltk.
----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of darnold
> Sent: Saturday, August 25, 2012 2:55 PM
> To: r-help at r-project.org
> Subject: Re: [R] Turning of source echo
>
> 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.
>
> ______________________________________________
> 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