On Fri, Jun 27, 2014 at 8:26 AM, Ross Ahmed <rossahmed@googlemail.com> wrote:
Lets say I have a file on desktop called called ‘test.csv’. I discovered by accident that if I drag ‘test.csv’ to an R file, this code is pasted into the R file:

read.csv(file = "../../../../Desktop/test.csv", header = TRUE, stringsAsFactors = FALSE)

But if the file is a .xls file, only this get pasted into the R file:


How can I add a command that, when I drag a .xls file into an R file, this get pasted in:


You will need to add a new "File Drop Action" to the R bundle. Have a look at the "read.csv (*.csv)" action in the Bundle Editor (TM2 Bundle → Edit Bundles.. → R → File Drop Action → read.csv (*.csv)). To create a new "File Drop Action" use ⌘N → Drag Command.

textmate mailing list