[R-SIG-Mac] How to put below code in Automator in iOS

David Winsemius dwinsemius at comcast.net
Thu Oct 27 20:44:06 CEST 2016


> On Oct 27, 2016, at 11:25 AM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
> 
> Hi,
> 
> I just have used that to provide an example what I am onto. My actual
> code is something else and kind of personal nature since some
> proprietary data are there. However essentially they are same.
> 
> What I am intending to do is, there will be some .app file which maps
> that R code. Once user run that .app file by double clicking it, some
> pop up will open and user shall provide further customized inputs. And
> resultingly the final calculated data in csv file will be saved in
> hard disk. In this way, user wont need to open R window, copy paste
> the R code to do same calculation. So to me, this .app approach looks
> more neat and simple from user's perspective.

The Markmail link offered some suggestions. They all used the R console engine and not Rscript.

> 
> Thanks,
> 
> On Thu, Oct 27, 2016 at 11:38 PM, David Winsemius
> <dwinsemius at comcast.net> wrote:
>> 
>>> 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
>> 

David Winsemius
Alameda, CA, USA



More information about the R-SIG-Mac mailing list