Skip to content

How to put below code in Automator in iOS

9 messages · Christofer Bogaso, David Winsemius

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

Thanks for your time.
#
You should post the code that is in your .R file.
David Winsemius
Alameda, CA, USA
#
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.
David Winsemius
Alameda, CA, USA
#
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
David Winsemius
Alameda, CA, USA
#
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)

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

Thanks,

On Thu, Oct 27, 2016 at 11:38 PM, David Winsemius
<dwinsemius at comcast.net> wrote:
#
The Markmail link offered some suggestions. They all used the R console engine and not Rscript.
David Winsemius
Alameda, CA, USA
#
Hi,

I have gone through it, however looks like too technical from IT point
of view. I am struggling there since I am pure Math background not
much hands on on IT technicalities. Could you please provide any
pointer if any simpler solution is available for my problem.

On Fri, Oct 28, 2016 at 12:14 AM, David Winsemius
<dwinsemius at comcast.net> wrote: