I'm trying the example on Hadley's page. I save the following into a file called "test.R"
#' Add together two numbers. #' #' @param x A number. #' @param y A number. #' @return The sum of \code{x} and \code{y}. #' @examples #' add(1, 1) #' add(10, 1) add <- function(x, y) { x + y } Then from the R workspace I try > document() Error: Could not find package root. And also > document('path\\to\\file\\test.R') And gives same error Below is my session information. > sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] devtools_1.12.0 loaded via a namespace (and not attached): [1] magrittr_1.5 tools_3.3.1 withr_1.0.2 roxygen2_5.0.1 Rcpp_0.12.7 [6] memoise_1.0.0 stringi_1.1.1 stringr_1.1.0 digest_0.6.10 -----Original Message----- From: Michael Friendly [mailto:frien...@yorku.ca] Sent: Thursday, September 08, 2016 9:19 AM To: Doran, Harold <hdo...@air.org>; r-help@r-project.org Cc: Duncan Murdoch <murdoch.dun...@gmail.com> Subject: Re: R-specific Software Requirement Specification You might also or instead look at the roxygen way of doing things, which maps to Rd files, but are much easier to write. In R Studio, Code -> Insert Roxygen skeleton does this for you from an existing function. See: http://r-pkgs.had.co.nz/man.html #' title goes here #' #' description goes here #' #' @param p1 desc of p1 #' @param p2 #' @param ... #' @return #' @export #' @imports #' @author #' @seealso #' @examples #' example lines foo <- function (p1, p2, ... ) { } On 9/7/2016 12:46 PM, Duncan Murdoch wrote: > On 07/09/2016 11:35 AM, Doran, Harold wrote: >> I'm building a large program with many different people contributing >> to the coding in R and so it needs a well-articulated design spec. >> The program will have many different functions that must interact >> with each other, but the individual functions will be written by >> different people. >> >> I'm curious if anyone has an R-specific SRS document to share that >> they have used for a similar purpose listing the objectives for each >> function, class definition, generics, what the function inherits >> from, and so on, or perhaps even a useful template for such work. > > The Rd help pages do some of this. They aren't so good at describing > the class hierarchy but are good at specifying individual functions. > > Duncan Murdoch > ______________________________________________ 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.