[R-SIG-Mac] How to put below code in Automator in iOS
David Winsemius
dwinsemius at comcast.net
Thu Oct 27 20:08:57 CEST 2016
> On Oct 27, 2016, at 11:05 AM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
>
> Hi,
>
> The code is same as in that page. i.e.
>
> require(tcltk)
>
> tt <- tktoplevel()
> rb1 <- tkradiobutton(tt)
> rb2 <- tkradiobutton(tt)
> rbValue <- tclVar("oranges")
> tkconfigure(rb1,variable=rbValue,value="apples")
> tkconfigure(rb2,variable=rbValue,value="oranges")
> tkgrid(tklabel(tt,text="Which do you prefer?"))
> tkgrid(tklabel(tt,text="Apples "),rb1)
> tkgrid(tklabel(tt,text="Oranges "),rb2)
>
> OnOK <- function()
> {
> rbVal <- as.character(tclvalue(rbValue))
> tkdestroy(tt)
> if (rbVal=="apples")
> tkmessageBox(message="Good choice! An apple a day keeps the doctor away!")
> if (rbVal=="oranges")
> tkmessageBox(message="Good choice! Oranges are full of Vitamin C!")
> }
> OK.but <- tkbutton(tt,text="OK",command=OnOK)
> tkgrid(OK.but)
> tkfocus(tt)
I'm predicting that you cannot get that file to do anything interesting with Rscript, so I don't understand why you think that you can use an Rscript-ing strategy within Automator.
--
David.
>
> On Thu, Oct 27, 2016 at 11:10 PM, David Winsemius
> <dwinsemius at comcast.net> wrote:
>>
>>> On Oct 27, 2016, at 10:32 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>>
>>>
>>>> On Oct 27, 2016, at 10:16 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>>>>
>>>>
>>>>> On Oct 27, 2016, at 10:07 AM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Previously I posted this same thread in general R help, however folks
>>>>> there suggested to post in this specialized group for better answer.
>>>>>
>>>>> I have a piece of code available here
>>>>>
>>>>> http://mcu.edu.tw/~chenmh/teaching/project/r/reference/RTclTkExamples/radiobuttons.html
>>>>>
>>>>> Now I put that code in a .R file and then created an .app file in Mac
>>>>> using Automator as explained below
>>>>>
>>>>> https://www.r-bloggers.com/how-to-source-an-r-script-automatically-on-a-mac-using-automator-and-ical/
>>>>>
>>>>> Surprisingly what I see is that, when I put that R code in a .app
>>>>> file, R fails to pop up the input window, which otherwise is fine when
>>>>> I just copy paste that code in R window.
>>>>>
>>>>> Could you please help if I need to have anything extra so that my .app
>>>>> will be able to take the input.
>>>>
>>>> You should post the code that is in your .R file.
>>>
>>> I have further concerns that I should have mentioned because I suspect you're trying to use functions that are not designed to be used inside Rscript process. The Tcl/Tk functions are designed to use in interactive sessions.
>>
>> And some searching on this matter shows that there have been prior suggested approaches to starting interactive R processes from a system console session:
>>
>> http://markmail.org/search/?q=list%3Aorg.r-project.r-help+rscript+interactive+tcl#query:list%3Aorg.r-project.r-help%20rscript%20interactive%20tcl+page:1+mid:uyykuacq77cuxoas+state:results
>>
>>
>>>>
>>>>
>>>>>
>>>>> Thanks for your time.
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac at r-project.org
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>
>>>> David Winsemius
>>>> Alameda, CA, USA
>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>> David Winsemius
>>> Alameda, CA, USA
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>> David Winsemius
>> Alameda, CA, USA
>>
David Winsemius
Alameda, CA, USA
More information about the R-SIG-Mac
mailing list