2
我在的R包開發相當新的,所以這可能是一個愚蠢的問題,但我希望我能在這裏得到一些幫助......rStudio自動完成說明和用法
我開發使用一個小型封裝中的R從哈德利Wickem http://adv-r.had.co.nz/Package-development-cycle.html
手冊我切換到dev_mode(),安裝()我的包,並與庫加載(包名)
所以一個例子:
#' logging function
#'
#' This function tries to use logging functionality. If the logging package
#' isn't installed, it uses a normal print command
#'
#' @param string the string to print
#' @param level the level of the log output, for example \code{WARN},
#' \code{INFO} or \code{ERROR}
#' @examples
#' \dontrun{
#' mylog('for your information')
#' mylog('this is a warning','WARN')
#' }
mylog <- function(string,level='INFO') {
tryCatch(
switch(level,
WARN=logwarn(string),
ERROR=logerror(string),
INFO=loginfo(string),
{logwarn(sprintf('warnlevel "%s" is not defined!',level))
loginfo(string)}),
error=function(condition) {
cat(sprintf('%s: %s\n',level,string))
})
}
現在當我鍵入?mylog
我讓我在裏面rStudio幫助窗口幫助...但是當我嘗試使用自動完成選項卡,有這個小彈出窗口沒有信息...
所有其他軟件包中有一些信息,如何使用該功能。
希望有人可以給我一個提示...
謝謝你的問題,這就是我正在尋找。 –
實際上,它看起來像我找到了解決方案...我必須用'@ export'標籤導出函數...現在幫助出現... – drmariod