Hi All,

I began to document my functions using roxygen2. This is an example of a 
function I would like to write for training and testing purposes:

t_simple_table <- function(variable,
                           useNA = TRUE,
                           print = FALSE) {
    #' @title Create a simple table for one variable.
    #'
    #' @description t_simple_table() creates absolute and relative 
    #' frequencies, cumulative sums and column sums for both as well as
    #' overall statistics about valid N and missing values.
    #' 
    #' 
    #' @param variable (vector, list, data.frame): variable the table is
    #' created for.
    #' @param useNA (logical): flag to include or exclude missing values
    #' from the computation.
    #' @param print (logical): flag to print/not print a table before
    #' returning it as an object.
    #' 
    #' @operation
    #' Coerces the given variable to a factor.
    #' If useNA = TRUE NA is also transformed to a valid value,
    #' if useNA = FALSE it is disregarded in all operations.
    #' 
    #' @return Returns a table with the following statistics:
    #' 
    #' <Variable Name> Frequencies   Percent   Cumulative
    #'                                         Percent
    #' Valid                     .         .
    #' Missing                   .         .
    #' Total                     .       100
    #' Categories
    #'   Cat 1                   .         .            .
    #'   Cat 2                   .         .            .
    #'   Cat 3                   .         .            .
    #'   ...                     .         .          100
    #'   Total                   .       100
    #'
    #' @errorhandling None
    #' 
    #' @version "0.1"
    #' 
    #' @created "2016-10-11"
    #' @updated "2016-10-11"
    #' 
    #' @status development
    #'
    #' @see Manderscheid: Sozialwissenschaftliche Datenanalyse mit R, 
    #' p. 79ff
    #'
    #' @author Georg
    #'
    #' @license GPL-2
 
# function body to be defined

}

Is this a correct header for a function?

How could I do better?

Kind regards

Georg

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to