RStudio 可以为函数自动生成 roxygen 模板吗? [英] Can RStudio automatically generate an roxygen template for a function?

查看:40
本文介绍了RStudio 可以为函数自动生成 roxygen 模板吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RStudio 是否支持任何自动化的 roxygen 模板创建?

Does RStudio support any automated roxygen template creation?

在 Emacs-ESS 中,C-x C-o 将为函数生成一个 roxygen 模板.例如,它会自动转换:

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

进入这个:

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

RStudio 中是否存在类似的功能?

Does similar functionality exist within RStudio?

更新

  • ESS 12.09-2 起,该命令已更改抄送 Co Co
  • 此功能已在 Rstudio 中实现:CTRL+ALT+SHIFT+R

推荐答案

(将@Crops 评论转换为完整答案)

(Converting @Crops comment into a full answer)

在 RStudio v0.99 中,.R 文件的代码"菜单下有一个新选项:插入 Roxygen 骨架".RStudio 中有一张图片关于 v0.99 预览版的博文.

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.

这篇关于RStudio 可以为函数自动生成 roxygen 模板吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆