[R] demo creating

jim holtman jholtman at gmail.com
Fri Sep 16 17:07:37 CEST 2011


I use NotePad++ and keep the source in there and then can highlight
and copy over to the R session by pressing a key.  You can easily
extend this with the use of AutoHotKey to make it dependent on a mouse
click if you wanted.

On Fri, Sep 16, 2011 at 10:53 AM, John Clark <rosbreed.pba at gmail.com> wrote:
> My question was not related to embedding R codes in powerpoint / word,
> rather I need to execute some of the commands in sequential way in R, so
> that I do not need to type them. This is similar to what you get when you
> use the following demo:
>
> require(lattice);
>
> demo(lattice)
>
> So I want to put my commands in the same way into a flow
>
> Thanks for the suggestions:
>
>
>
> On Fri, Sep 16, 2011 at 9:39 AM, Duncan Murdoch <murdoch.duncan at gmail.com>wrote:
>
>> On 15/09/2011 10:22 PM, John Clark wrote:
>>
>>> R experts:
>>>
>>> I want to prepare a demo (that will play sequentially in clicks) for a
>>> presentation tutorial...Can somebody help me how can I write a demo,
>>> suppose
>>> the following are steps in the demo..
>>>
>>> #start
>>> set.seed(1345)
>>> x1<- sample(letters[1:10], 5)
>>> x1
>>> sort(x1)
>>> x<- sample(1:10, 5)
>>>  y<- sample(c(11:20), 5)
>>> require(lattice)
>>> plot(x,y)
>>> z<- rnorm(5, 1, 0.5)
>>> dataframe<- data.frame(x, y, z)
>>> model1<- lm(y ~x)
>>> aov(model1)
>>> #end
>>> Please help me, I could not get proper function / package to it.
>>>
>>
>> I would use the tcltk package for this, but it does mean you need to learn
>> the TCL/TK language.  For example, I have used this in a presentation:
>>
>> demos <- function() {
>>    base <- tktoplevel()
>>    tkwm.title(base,"Demos")
>>    font <- "{Arial 24}"
>>    tkpack(tkbutton(base, command=PointCloud, text="Point cloud",
>> font=font), side="left")
>>    tkpack(tkbutton(base, command=Volcano, text="Volcano", font=font),
>> side="left")
>>    tkpack(tkbutton(base, command=ChangeColour, text="Change colour",
>> font=font), side="left")
>>    tkpack(tkbutton(base, command=SmoothingDemo, text="Smoothing",
>> font=font), side="left")
>> }
>>
>> PointCloud, Volcano, ChangeColour, and SmoothingDemo are regular R
>> functions, called with no arguments when you click on their button.
>>
>> Duncan Murdoch
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list