roxygen2

devtools roxygen package creation and rd documentation

≯℡__Kan透↙ 提交于 2019-12-18 11:34:34
问题 I am new to roxygen and am struggling to see how to be able to use it to quickly create a new/custom package. I.e. I would like to know the minimum requirements are to make a package called package1 using devtools , roxygen2/3 so that I can run the commands require(package1) fun1(20) fun2(20) to generate 2000 and 4000 random normals respectively So lets take the simplest example. If I have two functions fun1 and fun2 fun1 <- function(x){ rnorm(100*x) } and fun2 <- function(y){ rnorm(200*y) }

devtools roxygen package creation and rd documentation

眉间皱痕 提交于 2019-12-18 11:34:33
问题 I am new to roxygen and am struggling to see how to be able to use it to quickly create a new/custom package. I.e. I would like to know the minimum requirements are to make a package called package1 using devtools , roxygen2/3 so that I can run the commands require(package1) fun1(20) fun2(20) to generate 2000 and 4000 random normals respectively So lets take the simplest example. If I have two functions fun1 and fun2 fun1 <- function(x){ rnorm(100*x) } and fun2 <- function(y){ rnorm(200*y) }

roxygen2 not fully updating DESCRIPTION file

故事扮演 提交于 2019-12-17 21:01:30
问题 I'm making my first package rlandscape , using Roxygen2 and trying to follow the plain Roxygen vignette since Roxygen2 doesn't have one. As in the vignette (page 3), I created a file called rlandscape-package.R that contains nothing but package documentation. In the vignette, they say each Roxygen description block must be followed by a statement, even header material that describes a le or package in lieu of a specific function. roxygen() is provided as a NOOP (null statement) to stand in

How to properly document S4 methods using roxygen2

谁说胖子不能爱 提交于 2019-12-17 17:28:29
问题 I've seen some discussions in SO and other places regarding how this should be or will be done in future versions of Roxygen2. However, I am stuck. How should I go about documenting a S4 generic, as well as its methods, using Roxygen2? A working example for a brand new generic/methods, as well as an example for extending base S4 generic would be incredibly useful. I do not want to have to make separate (mostly) redundant documentation for each S4 method of the same generic. Due dilligence: I

Writing 'as.data.frame' method for custom S3 objects

最后都变了- 提交于 2019-12-14 03:26:17
问题 In many variants, similar questions have been asked many times ... but i do not find a clear advice about: "exporting S3 methods as functions" I wrote a custom S3 class with roxygen2 , call it 'my_item' . This is the constructor function: my_item <- function(n) structure(list(n=n),class='my_item') What I need is a way to define a "list of my_items => data.frame" cast function: #' @method as.data.frame my_item #' @export as.data.frame.my_item <- function(x) ... As soon as I call it with a my

Puzzling “unexpected END_OF_INPUT” while building package with roxygen2

孤者浪人 提交于 2019-12-13 18:09:33
问题 I'm trying to release this package, but it keeps failing on build. I get variations on this in both build and check : Warning: /tmp/RtmpUUrH6N/Rbuild51f35b160bfe/taRifx.geo/man/interpolateAndApplyWithinSpatial.Rd:66: unexpected END_OF_INPUT ' I have traced the problem to a single line in the @examples for interpolateAndApplyWithinSpatial() : #' \dontrun{ #' require(fields) #' require(rgdal) #' distanceMatrix <- function( points1, points2, dist.fn=rdist.earth ) { #' cat( "Generating distance

With Roxygen and testthat, what is the proper way to make internal helper functions available to testcases called during R CMD check?

喜你入骨 提交于 2019-12-12 20:41:13
问题 I am creating an R package, and found it useful to break parts of the logic in one file into internal helper functions, which I define in the same file. I have sort of a special case where my function decides which helper function to use via match.fun() . Since they won't be useful to other functions or people, I don't want to put these in separate files, and I don't want to export them. All my testthat cases pass using test_dir() . When I don't export these functions, my testthat cases fail

Error during build and reload in R

可紊 提交于 2019-12-12 05:29:19
问题 I am roxygenizing a package I am making in R. The script is #' HandyTools #' #' Check if required packages are installed or not and installs them if not #' @param packageList - a list containing the required package names #' #' @examples #' checkPackagesLibrary(c("lme4","epitools","roxygen2")) #' #' @export library(devtools) checkPackagesLibrary <- function(packagesList){ new.packages <- packagesList[!(packagesList %in% installed.packages(lib.loc="/data/legacy/user/R_Packages")[,"Package"])]

Equations in r package documentation do not work

冷暖自知 提交于 2019-12-12 01:09:40
问题 I'm using roxygen2 for my package description and I want to have mathematic equations in my documentation. For example I want to write n_{u} like a formula. When I write \eqn{n_{u}} in @details nothing happens but the text is italic. I document the package with control, shift and d and then i push "Clean and rebuild". Did I forget anything? 回答1: This is expected behaviour. The R documentation format doesn't have "real" equations like you might get from Mathjax or another fully-fledged Latex

R - Importing 'xlsx' package to my own package doesn't work

最后都变了- 提交于 2019-12-11 14:30:00
问题 I am creating my own package. I am using a lot of existing packages in it and they work. I am using the same procedure for the xlsx package but it doesn't work. I have xlsx in Imports: in my DESCRIPTION file. I have @import xlsx in my respective .R file. I also tried @importFrom write.xlsx for a particular function with the same result. I am using libraries devtools and roxygen2 for creating the package. My new package is build, but if I proceed Check , an error occurs: Installation failed.