@docType package
@import
, @importFrom
, etc.contrast_rsa_model
Function and Methods@param output_metric
documentation in contrast_rsa_model()
to clearly state it accepts a character vector of metrics[x] Document that duplicates are removed while preserving first-occurrence order
Return Value Documentation Update
[x] Update @return
for train_model.contrast_rsa_model()
to explain it returns a named list where:
output_metric
Examples Update
contrast_rsa_model()
showing multiple metrics requested:
r
model_multi_metric <- contrast_rsa_model(
dataset = mvpa_dat,
design = msreve_des,
output_metric = c("beta_delta", "recon_score", "beta_only")
)
train_model.contrast_rsa_model()
showing the structure of the returned list when multiple metrics are requested[ ] Update any other examples that use output_metric
to reflect it's now a vector
Print Method Update
print.contrast_rsa_model()
correctly shows all requested metrics@export
tag) have full documentation\dontrun{}
for examples (CRAN will reject these)\donttest{}
when absolutely necessary (for long-running examples)@param
@return
\describe{}
or itemize to detail components@format
and @source
@rdname generic_function
to link method documentation to the genericrsa_model()
, mvpa_dataset()
):@export
and appropriate naming (function.class
)requireNamespace()
calls:requireNamespace()
ONLY for packages listed in Suggests
fieldImports
field and remove requireNamespace()
guard clausesrsa_model.R
, ensure dependencies like "crayon" are properly listed in either Imports
or Suggests
contrast_rsa_model.R
, ensure packages like "glmnet" (if needed) are properly declared@export
tags for consistency@import
vs. @importFrom
usage (prefer specific imports)Collate
field if specific file order is neededdevtools::document()
to generate documentationrequireNamespace()
is not used unless the package is in Suggests
fieldList of all S3 generic/method families found in the package:
get_unique_regions()
strip_dataset()
select_features()
format_result()
merge_results()
run_future()
process_roi()
train_model()
y_train()
y_test()
test_design()
fit_model()
tune_grid()
has_test_set()
has_crossval()
performance()
compute_performance()
merge_classif_results()
get_samples()
data_sample()
as_roi()
get_searchlight()
wrap_output()
merge_predictions()
sub_result()
nobs()
prob_observed()
nresponses()
predict_model()
run_searchlight()
run_regional()
crossval_samples()
pairwise_dist()
filter_roi()
get_nfolds()
train_indices()
balance_partitions()
print()
(for custom classes)For each of these generics:
1. Document the generic function fully
2. For methods, use @rdname
to link to the generic's documentation
3. Only add method-specific documentation if the method has additional parameters or significantly different behavior
This list outlines key areas and actionable items to ensure Roxygen documentation meets CRAN standards.
check off completed items when done.
packageName-package.R
).#' @keywords internal
and "_PACKAGE"
alias if using the common pattern.\\link{}
or \\code{\\link{}}
.codetools::checkUsageEnv(desc::desc_get_field("Package"))
can help).@title
):@description
):@param parameter_name
):@param
tags in the method's Roxygen block if:...
from the generic, and you want to document specific arguments passed through ...
for this particular method.numeric vector
, character string
, data.frame
).@return
):@return
in the method's Roxygen block if the return type or structure is specific to that method and differs from the generic's description.@details
):@details
can be used in the method's Roxygen block if there are nuances highly specific to that method's implementation not covered by the generic's details.@examples
):@dontrun
. Never use @dontrun
. Use @donttest
for examples that are computationally intensive, require specific external resources not available on CRAN, or might fail due to stochasticity not controlled by set.seed
. However, code within @donttest
blocks must still be theoretically runnable (e.g., use loadable data, no placeholder file paths or undefined variables).set.seed()
for examples involving randomness to ensure reproducibility.R CMD check
.@export
for generics/standalone, @exportS3Method
or auto-detection for methods):@export
tag is present for all generic functions and standalone functions intended for users.S3method(generic, class)
in NAMESPACE
). This is often handled automatically by Roxygen if the generic is exported and methods are named generic.class
. Explicit @exportS3Method generic class
can also be used if needed.@noRd
is used for all internal/helper functions not meant for users.@importFrom package function
for specific function imports.DESCRIPTION
Imports field and use package::function
calls (though @importFrom
is often preferred for clarity and avoiding masking).@import package
unless absolutely necessary, as it imports the entire namespace.requireNamespace()
calls to guard code unless the package is in Suggests
and its absence should not break the function (provide alternative behavior).@seealso
):\\code{\\link{function_name}}
or \\link[package_name]{function_name}
. Typically placed in the generic's documentation.@keywords
):internal
, datasets
) if applicable, though often less critical if other documentation is thorough.R/data.R
).@docType data
, @name data_name
, @aliases data_name
, @title
, @description
, @format
, @source
, @keywords datasets
, @examples
).@format
: Describe the structure of the dataset (e.g., "A data frame with X rows and Y variables: ..."). List and describe each variable/column.LazyData: true
is in the DESCRIPTION
file if applicable.my_generic <- function(x, ...) UseMethod("my_generic")
) is fully documented with @title
, @description
, @param
for all its arguments (including ...
), @return
, @details
, and @examples
that ideally show usage with important methods.R/generic.class.R
or similar):...
and the method defines specific arguments passed via ...
), document these new parameters using @param
in the method's Roxygen block.@details
or refine @return
in the method's Roxygen block.generic.class
. If necessary, use @rdname generic_function_name
in the method's Roxygen block to explicitly link it to the generic's documentation topic, ensuring all methods appear on the same help page as the generic.S3method(generic, class)
directives in NAMESPACE
. This is crucial for method dispatch and is usually handled automatically by devtools::document()
.@slot
for slots.exportClasses
, exportMethods
directives in NAMESPACE
.DESCRIPTION
file under VignetteBuilder
(e.g., knitr
) and Suggests
(e.g., knitr
, rmarkdown
).R CMD check
.\\VignetteIndexEntry{Vignette Title}
in the vignette source.NAMESPACE
file is generated by devtools::document()
(which runs Roxygen) and is not manually edited.NAMESPACE
for correctness (exports, S3 methods, imports).x.y.z
or x.y.z.9000+
conventions.[aut, cre]
).GPL-3
, MIT + file LICENSE
).dplyr (>= 1.0.0)
).URL
: Link to package repository (e.g., GitHub).BugReports
: Link to issue tracker.Encoding: UTF-8
is recommended.@description
or @details
).devtools::document()
: Regenerate documentation and NAMESPACE
frequently.devtools::check(cran = TRUE)
or R CMD check --as-cran yourpackage_version.tar.gz
:rhub::check_for_cran()
.@donttest
appropriately (see note in Section II about @dontrun
vs @donttest
).requireNamespace()
is not used unless the package is in Suggests
fieldAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.