2013-03-05 4 views
11

Ho scritto un piccolo pacchetto per mio uso personale e l'utilizzo di devtools è andato tutto molto bene. Tuttavia, ho provato a eseguire R CMD Verifica su di esso e ho ricevuto un numero di errori, apparentemente perché il mio uso e gli esempi utilizzano funzioni dalla base R che non sono nel mio pacchetto, ad esempio qui la mia funzione minima e la documentazione di roxygenErrore Oggetti in usage senza alias nell'oggetto documentazione da R CMD Verifica

#' Function to Sort a dataframe with a given list of columns 
#' Cribbed from Spector, P. (2008). "Data Manipulation with R", UseR! Springer. Pg78 
#' @param df Dataframe to be sorted 
#' @param ... list of columns to sort on 
#' @return A sorted dataframe 
#' @author "Paul Hurley" 
#' @export 
#' @usage with(dataframe,sortframe(dataframe,column1, column2, column3)) 
#' @examples with(iris,sortframe(iris,Sepal.Length,Sepal.Width,Petal.Length)) 
sortframe<-function(df,...){df[do.call(order,list(...)),]} 

e R CMD check dà

Undocumented arguments in documentation object 'sortframe' 
    'dataframe' 'sortframe(dataframe, column1, column2, column3)' 
Documented arguments not in \usage in documentation object 'sortframe': 
    'df' '...' 
Objects in \usage without \alias in documentation object 'sortframe': 
    'with' 

c'è un modo per dire R CMD Controllare/roxygen2 che queste funzioni sono descritte in base?

risposta

3

Non si deve includere un tag @usage. Roxygen lo dedurrà dal tuo codice. il tuo @usage è davvero un esempio. R si lamenta perché ti stai riferendo a oggetti che non sono affatto nella tua definizione di funzione. @usage, se insisti a metterlo in te stesso, dovrebbe fare riferimento solo a sortframe, df e .... Poiché hai già un @example, dovresti essere in grado di omettere il tag @usage.