r-pkgs | Building R packages | Build Tool library
kandi X-RAY | r-pkgs Summary
kandi X-RAY | r-pkgs Summary
Building R packages
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of r-pkgs
r-pkgs Key Features
r-pkgs Examples and Code Snippets
Community Discussions
Trending Discussions on r-pkgs
QUESTION
I wrote a vignette for an R package of mine. It is built without any errors, using both devtools::built()
and the tool built into RStudio with the vignettes option selected. The html output file is placed in the vignettes
directory, but it does not show up in the list printed by vignette(all = T)
and the User guides, package vignettes and other documentation link is not added to the documentation.
As recommended on this site, I already reinstalled the package using devtools::install()
, made sure that the directory is called vignettes
, and checked whether the vignettes were excluded in .Rbuildignore
(it contains ^.*\.Rproj$
and ^\.Rproj\.user$
).
This is the (anonymized) header of the Rmd file:
...ANSWER
Answered 2021-May-24 at 10:15I have a solution, from here. You need to force installation of the vignette when installing your package.
Example with local package :
QUESTION
Following advice about NAMESPACE and External Data formatting/setup, I have:
A. My data files in mypackage/data/datafilename.RData
B. The data script as mypackage/R/data.R with data files individually named and described within that one file, having just changed "itemize" to "describe" and changing the format of those item lines:
C. I've document()
-ed this, commit-pushed to github, and install_github
reinstalled locally.
Help for the data files works:
But I can't access those data, whereas I can access data in other packages using the same method:
Can anyone think why this would be? NAMESPACE doesn't include these as exports
:
But it's autogenerated by document()
so that's arguably out of my control. By comparison, mapplots
' NAMESPACE has exportPattern(".")
Environment for the package also doesn't include them, but I don't know if this is expected or not, based on lazy loading (which is true):
Any ideas welcome. I've tried data(gbm.auto:grids)
with 1, 2 & 3 colons, to no avail. Based on the answer to this related question (also by me), I get the suspicion that there might be some issue whereby only the last named object in data.R
is important/accessible?
usethis
has been created since I've been updating this package and has use_data
and create_package
but I'm reluctant to try these out since ostensibly everything in my package should already be in order and I don't want to make things worse.
Thanks in advance. Reprex would be
...ANSWER
Answered 2020-Dec-18 at 18:46Data files in data
must have .RData extensions, not .Rdata
Bug filed here.
QUESTION
My apologies in advance if this is an obvious question but I have searched both stack overflow and what have been otherwise very useful resources like R packages by Hadley Wickham or this blog and can not find an answer.
My issue occurs when trying to run build_vignettes()
on my developed R package (myPackage
). The vignette for the package (myPackage.Rmd
) will create as expected using knit in RStudio but when I run build_vignettes()
, I get the following error:
ANSWER
Answered 2020-Oct-25 at 22:34I solved the second error you get updating packages devtools and usethis.
QUESTION
ANSWER
Answered 2020-Sep-17 at 09:20Cross-platform reproducibility is more imprtant. Setting the collation to C
makes sure, tests give the same result across all platforms.
Options to deal with this change if sort
caused the problems (sort depends on the collation)** you have at least 3 different options:
The use of
stringr::sort()
: New dependence onstringr
packageCustomize your function without additional packages
QUESTION
I would like to use R objects (e.g., cleaned data) generated in one RStudio project in another RStudio project.
Specifically, I have multiple RStudio projects (that hold drake
plans) that do various things for my thesis experiments (e.g., generate materials, import and clean data, generate reports/articles). I want to import objects (mainly data and materials) that I generated in these projects into another RStudio project that generates my thesis report. It seems to make sense to keep the individual experiments as separate projects (with separate git
repositories) because they each have so many components.
At the moment I can see three ways of doing this:
- Re-create the data cleaning process
- But: this involves copy/paste, which I'd like to avoid, especially if things change upstream.
- Access the relevant scripts/functions by changing the working directory
- But: even if I used
here
it seems that this would introduce poor reproducibility.
- But: even if I used
- Make the source projects into packages and make the objects I want to "export" into exported data (as per the data section of Hadley's R packages guide)
- But: I'd like to avoid the unnecessary metadata, artefacts, and noise (e.g., see Miles McBain's "Project as an R package: An okay idea") if I can.
Is there any other way of doing this?
...ANSWER
Answered 2020-Aug-20 at 13:56My first recommendation is to use a single drake
plan to unite the stages of the overall project that need to share data. drake
is designed to handle a lot of moving parts this way, and it will be more seamless when it comes to drake
's decisions about what to rerun downstream. But if you really do need different plans in different sub-projects that share data, you can track each shared dataset as a file_out()
file in one plan and track it with file_in()
in another plan.
QUESTION
I am writing an R package, and started to include C code in it. Following instructions from here, under "getting started with .C()", I created a c function in src/, and an r wrapper to it, linking via the roxygen tag @useDynLib(, )
.
However, after running devtools::document()
, I get the following error:
ANSWER
Answered 2020-Aug-20 at 09:41It turns out that the problem is in this line
QUESTION
I am writing a package for my use. I created objects of class marco, say.
Then I wrote some methods, like print.marco
, plot.marco
, etc, which I would like to be applied with print(obj)
where class(obj) = "marco"
. In the NAMESPACE file (created with roxygen2::document()
), these functions are simply exported as such and not as S3method
and are not recognized as such by sloop::is_s3_method
.
I searched the internet and I can't find an answer or clear example. Following In Hadley Wickham's R packages in my R script I simply document the functions adding #' @export print.marco
, etc.
A minimal example
...ANSWER
Answered 2020-Aug-03 at 23:36So, the answer was that i was using the wrong @export
directive.
I used @export print.marco. This overrides the creation of S3 methods. Putting simply @export works fine. Thanks to Roland for his comments above.
QUESTION
I'm trying documenting datasets for a r-package as here http://r-pkgs.had.co.nz/data.html#documenting-data. Each data consist in single vectors and I wrote in each data1.R
something like this:
ANSWER
Answered 2020-Jun-20 at 20:27All package objects should be documented to avoid the warnings.
You should launch :
QUESTION
I get this warning
...ANSWER
Answered 2020-May-22 at 10:45When used, data-raw
should be added to .Rbuildignore
. As explained in the Data section of Hadley's R-Packages book (also linked in the question)
Often, the data you include in
data/
is a cleaned up version of raw data you’ve gathered from elsewhere. I highly recommend taking the time to include the code used to do this in the source version of your package. This will make it easy for you to update or reproduce your version of the data. I suggest that you put this code indata-raw/
. You don’t need it in the bundled version of your package, so also add it to.Rbuildignore
. Do all this in one step with:
QUESTION
My package will not install, either on my machine or on travis-ci.org. The only update from the version on CRAN is that I added a vignette. I have been following the examples of Rcpp - package and R-packages; compiled code.
The error is related to these prior questions but not a duplicate.
- Q40922814 -- problem here was the use of both C and C++ code. I only use C++ code
- Q36952571 -- I'm on Mac OS, so no access to
ldconfig
, though perhaps my problem is related.
from the package directory:
...ANSWER
Answered 2020-May-02 at 23:07I think, based on a quick poke, that your package is borked.
The install step fails on
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install r-pkgs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page