[R] Turning of[f] source echo

David Winsemius dwinsemius at comcast.net
Mon Aug 27 22:32:59 CEST 2012


I wasn't an Rstudio user at that point, but now that I am a new user,  
I am wondering "how" you were interacting with the Rstudio windows. I  
have an editing window open and is has both a "Run" button and a  
"Source" button. I get the behavior you describe when I hit the Source  
button and the behavior you desire when I hit the Run button.

And if you were doing it with the menu or keyboard shortcuts you would  
also choose "run" versus "source" (at least on a Mac the menus are  
where you typically learn the default keyboard shortcuts and you can  
generally edit them with the MacOS tools.

-- 
David
On Aug 25, 2012, at 12:54 PM, darnold wrote:

> 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.
>
>




More information about the R-help mailing list