113

私は現在、Bing Maps キーを持つことに依存するジオコーディング関数を作成しています。明らかに、私は自分のものを公開したくありません。例は公開しないと失敗します。

ユーザーが手動で実行するための例を含めるにはどうすればよいR CMD checkですか?

4

5 に答える 5

176

使用する\dontrun{}

#'@examples
#'\dontrun{
#'geocode("3817 Spruce St, Philadelphia, PA 19104")
#'geocode("Philadelphia, PA")
#'dat <- data.frame(value=runif(3),address=c("3817 Spruce St, Philadelphia, PA 19104","Philadelphia, PA","Neverneverland"))
#'geocode(dat)
#'}
于 2012-08-20T13:03:15.377 に答える
2

アリ、私も roxygen2 (バージョン 4.1.0) を使用しています。以下は、私の関数 (gctemplate) 定義の roxygen2 マークアップの終わりから実際の部分の始まりまでです。

#' @examples
#' ## List all G-causalities in a VAR system of 5 variables that will be searched in the pattern of 1 
#' ## causer (like-independent) variable and 2 like-dependents conditional on 5-(1+2)=2 of the remaining 
#' ## variable(s) in the system. Variables are assigned to numbers 1 to nvars. 
#' ## "1 2 5 3 4" in the resulting line of gctemplate is to indicate the 
#' ## (conditonal, partial, etc.) G-causality from variable 1 to variables 2 and 5 
#' ## conditonal on variables 3 and 4.
#' # gctemplate(5,1,2)
#' ## The number of all G-causalities to be searched in the above pattern.
#' #dim(gctemplate(5,1,2))[[1]]
#' @importFrom combinat combn
#' @export
gctemplate <- function(nvars, ncausers, ndependents){
...

私は GSee の dontrun メソッドを知っています。
私の手法では、数値例と数値例を説明するテキストは両方ともコメントです。この 2 つを区別するためにインデントを使用します。"#'" の後にそれぞれ 1 つのシャープと 2 つのシャープがあることに注意してください。私のパッケージでは、常に上記の「#' ## / #' #」テクニックを使用しています。ユーザーは、機能をテストしたいときはいつでもコピーアンドペースト操作を行う必要があります。この手法は、私によると、ソフトウェアコーディング哲学の古典的なコメント攻撃とより類似しています。

于 2014-12-25T19:14:21.727 に答える