Let's say I have R open and i’m editing a .R filewith TextMate. In my .R file I have a line of code like this:

lm(mpg ~ drat, mtcars)

Is it possible to set up a keyboard shortcut, which when pressed whilst an R object was selected, would send that object to the R console inside a function.

For example:
I select 'mpg', press COMMAND + OPTION + L, and this object would be run in the R console as: length(mpg)

I select ‘mtcars', press COMMAND + OPTION + S, and this object would be run in the R console as: summary(mtcars)

I select 'lm(mpg ~ drat, mtcars)', press COMMAND + OPTION + P, and this object would be run in the R console as: plot(lm(mpg ~ drat, mtcars))

Thanks
Ross