0

I begin to learn how to use roxygen, so I found this post by @hadley and go down to this tutorial page: http://r-pkgs.had.co.nz/man.html

For doing the first example, I created a new project and a new test.R file.

I copied these example code to 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
}

After that, I run in console:

devtools::document()

But I got an error message:

Error: No description at D:\Conny\RStudio\try/DESCRIPTION

What I did wrong? Even I manually created "DeSCRIPTION" file, it still doesn't work.

Community
  • 1
  • 1
xirururu
  • 5,028
  • 9
  • 35
  • 64
  • 1
    You need to create the package first - [see here](http://r-pkgs.had.co.nz/package.html) – jeremycg Sep 14 '15 at 22:42
  • Hi @RichardScriven, do you mean I need to creat a package at first? Actually I tried it: I used `package.skeleton('try')`, it created a new sub folder 'try' sub folder. In this 'try' folder, there are many files, I don't know, what shall I do with so many files – xirururu Sep 14 '15 at 22:43
  • 2
    If you're following Hadley's writings, I suggest doing it in RStudio, where it is actually much easier imo. Just create a new project/package and follow the prompts. The DESCRIPTION file will be created in the proper place – Rich Scriven Sep 14 '15 at 22:46
  • @RichardScriven, thanks very much for the suggestion, I will follow the Hadley's instruction. :D – xirururu Sep 14 '15 at 22:48
  • 1
    It also looks like `package.skeleton("try", code_files = "test.R")` might work as well – Rich Scriven Sep 14 '15 at 22:49

0 Answers0