Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
181 views
in Technique[技术] by (71.8m points)

r - Can RStudio automatically generate an roxygen template for a function?

Does RStudio support any automated roxygen template creation?

In Emacs-ESS, C-x C-o will produce an roxygen template for a function. For example, it will automagically convert this:

foo <- function(x,y) x+y

into this:

##' .. content for description{} (no empty lines) ..
##'
##' .. content for details{} ..
##' @title 
##' @param x 
##' @param y 
##' @return 
##' @author David
foo <- function(x,y) x+y

Does similar functionality exist within RStudio?

updates

  • as of ESS 12.09-2, the command has been changed to C-c C-o C-o
  • this feature has been implemented in Rstudio: CTRL+ALT+SHIFT+R
question from:https://stackoverflow.com/questions/10825058/can-rstudio-automatically-generate-an-roxygen-template-for-a-function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

(Converting @Crops comment into a full answer)

In RStudio v0.99 there is a new option under the "Code" menu for .R files: "Insert Roxygen Skeleton". There is an image of it in RStudio's blog post about v0.99 preview.

Roxygen skeleton menu image from RStudio


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...