Create shortcut key for R function on Mac?

I would like to create a keyboard shortcut to start the R function in an existing R session. How can I do this on a Mac?

My first idea was to use

% R -slave <foo.R

and create a keyboard shortcut for the shell script with this command.

But this will start a new session R. Is there a way to send a command to an existing session from the shell?

+5
source share
1 answer

I can imagine two similar ways to do this; none of them are elegant, but both do the job.

  • Start a tmux session, which consists exclusively of an R session, and write a script that uses tmux send-keysto send your command.

  • , iTerm2 . iTerm2, . iTerm2, , applescript.

0

All Articles