Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: CastError
Message: Couldn't cast
package: string
license: string
license_gh: string
to
{'package': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'content': Value(dtype='large_string', id=None), 'size': Value(dtype='float64', id=None), 'license': Value(dtype='string', id=None)}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1492, in compute_config_parquet_and_info_response
fill_builder_info(builder, hf_endpoint=hf_endpoint, hf_token=hf_token, validate=validate)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 702, in fill_builder_info
num_examples_and_sizes: list[tuple[int, int]] = thread_map(
File "/src/services/worker/.venv/lib/python3.9/site-packages/tqdm/contrib/concurrent.py", line 69, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/tqdm/contrib/concurrent.py", line 51, in _executor_map
return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs))
File "/src/services/worker/.venv/lib/python3.9/site-packages/tqdm/std.py", line 1169, in __iter__
for obj in iterable:
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 609, in result_iterator
yield fs.pop().result()
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 446, in result
return self.__get_result()
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 574, in retry_validate_get_num_examples_and_size
validate(pf)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 640, in validate
raise TooBigRowGroupsError(
worker.job_runners.config.parquet_and_info.TooBigRowGroupsError: Parquet file has too big row groups. First row group has 350476440 which exceeds the limit of 300000000
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 797, in wrapped
for item in generator(*args, **kwargs):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/parquet/parquet.py", line 97, in _generate_tables
yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/parquet/parquet.py", line 75, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
return cast_table_to_schema(table, schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2256, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
package: string
license: string
license_gh: string
to
{'package': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'content': Value(dtype='large_string', id=None), 'size': Value(dtype='float64', id=None), 'license': Value(dtype='string', id=None)}
because column names don't match
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1505, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1099, in stream_convert_to_parquet
builder._prepare_split(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
package string | path string | content large_string | size float64 | license string |
|---|---|---|---|---|
igraphdata | cran-igraphdata-deedc8a/inst/getdata.R |
# igraphdata R package
# Copyright (C) 2010-2012 Gabor Csardi <csardi.gabor@gmail.com>
# 334 Harvard st, 02139 Cambridge, MA, USA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundatio... | 30,568 | cc-by-sa-4.0 |
assertthat | cran-assertthat-b28a7b8/R/assert-that.r | #' Assert that certain conditions are true.
#'
#' \code{assert_that} is a drop-in replacement for \code{\link{stopifnot}} but
#' is designed to give informative error messages.
#'
#' @section Assertions:
#'
#' Assertion functions should return a single \code{TRUE} or \code{FALSE}:
#' any other result is an error, and \... | 3,882 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/assertions-file.r | #' @include on-failure.r
NULL
path_is_not <- function(thing, var = "x") {
function(call, env) {
paste0("Path '", eval(call[[var]], env), "' is not ", thing)
}
}
#' Useful test related to files
#'
#' @param path a file path to examine
#' @name assertions-file
#' @examples
#' see_if(is.dir(1))
#'
#' tmp <- temp... | 1,568 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/assertions-scalar.R | #' @include on-failure.r
NULL
#' Assert input is a scalar.
#'
#' \code{is.scalar} provides a generic method for checking input is a scalar.
#' \code{is.string}, \code{is.flag}, \code{is.number} and \code{is.count}
#' provide tests for specific types.
#'
#' @family assertions
#' @param x object to test
#' @name scala... | 2,199 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/assertions.r | #' @include on-failure.r
NULL
is.integerish <- function(x) {
# using trunc() to deal with very large numbers (including Inf) and is.na() to deal with NaN and NA_real_
res <- is.integer(x) || (is.numeric(x) && all(x == trunc(x)) && !is.na(x))
res
}
# is.positive.integer
# is.negative.integer
# is.positive.double... | 4,368 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/base-comparison.r | #' @include base.r
NULL
logical_is_not <- function(failed) {
function(call, env) {
lhs <- paste(deparse(call[[2]]), collapse = "")
rhs <- paste(deparse(call[[3]]), collapse = "")
paste0(lhs, " not ", failed, " ", rhs)
}
}
base_fs$"==" <- logical_is_not("equal to")
base_fs$"<" <- logical_is_not("less ... | 536 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/base-is.r | #' @include base.r
NULL
is_not <- function(thing) {
function(call, env) {
paste0(deparse(call[[2]]), " is not ", thing)
}
}
# Vectors
base_fs$is.atomic <- is_not("an atomic vector")
base_fs$is.character <- is_not("a character vector")
base_fs$is.complex <- is_not("a complex vector")
base_fs$is.double <- is_no... | 1,529 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/base-logical.r | #' @include base.r
NULL
base_fs$"&&" <- function(call, env) {
lhs <- eval(call[[2]], env)
if (!lhs) {
get_message(lhs, call[[2]], env)
} else {
rhs <- eval(call[[3]], env)
get_message(rhs, call[[3]], env)
}
}
base_fs$"||" <- function(call, env) {
lhs <- eval(call[[2]], env)
l_msg <- get_messag... | 784 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/base-misc.r | #' @include base.r
NULL
base_fs$file.exists <- function(call, env) {
path <- eval(call[[2]], env)
paste0("Path '", path, "' does not exist")
}
base_fs$anyDuplicated <- function(call, env) {
paste0(call$x, " is not unique")
}
base_fs$identical <- function(call, env) {
paste0(deparse(call$x), " not identical t... | 344 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/base.r | base_fs <- new.env(parent = emptyenv())
| 40 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/on-failure.r | #' Custom failure messages for assertions.
#'
#' @param x a assertion function that returns \code{TRUE} if the assertion
#' is met, \code{FALSE} otherwise.
#' @param value a function with parameters \code{call} and \code{env}
#' that returns a custom error message as a string.
#' @export
#' @examples
#' is_odd <- f... | 803 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/utils.r | "%||%" <- function(a, b) if (is.null(a)) b else a
| 50 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/R/validate-that.R | #' Validate that certain conditions are true.
#'
#' \code{validate_that} is an alternative to the function
#' \code{\link{assert_that}}, that returns a \code{character} vector. This
#' makes them easier to use within S4 \code{"validate"} methods.
#'
#' @inheritParams assert_that
#' @return A \code{character} vector if ... | 888 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat.R | library(testthat)
library(assertthat)
test_check("assertthat")
| 64 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-assert-that.R | context("assert_that")
test_that("assert_that handles long false assertions gracefully", {
expect_error(
assert_that(isTRUE(10 + sqrt(25) + sum(1:10) + sqrt(25) + sum(11:20) + sqrt(25) + sum(21:30) + sqrt(25) + sum(31:40) + sqrt(25) + sum(41:50))),
"^isTRUE\\(.* [.]{3} is not TRUE$"
)
})
test_... | 565 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-assertions.R | context("Assertion assertions")
test_that("is.integerish works correctly", {
expect_true(is.integerish(1L))
expect_true(is.integerish(c(1L, 2L, 3L)))
expect_true(is.integerish(c(1L, NA, 3L)))
expect_false(is.integerish(c(1L, 2.1, 3L)))
# base::.Machine holds info on machine numerical precision
expect_fals... | 3,951 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-base-comparison.R | context("base-comparison")
test_that("assert_that respects custom error messages for base operators", {
expect_error(assert_that(5 == 'i'), "not equal to")
expect_error(assert_that(5 < 4), "not less than")
expect_error(assert_that(4 > 5), "not greater than")
expect_error(assert_that(4 >= 5), "not greater than ... | 454 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-base.R | context("Base assertions")
test_that("any message is useful", {
expect_equal(validate_that(any(TRUE, FALSE)), TRUE)
x <- c(FALSE, FALSE)
expect_equal(validate_that(any(x)), "No elements of x are true")
})
test_that("all message is useful", {
expect_equal(validate_that(all(TRUE, TRUE)), TRUE)
x <- c(FA... | 529 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-file.R | context("File assertions")
test_that("is.dir identifies dirs correctly", {
expect_true(is.dir(tempdir()))
expect_error(is.dir(tempfile()))
})
test_that("is.writeable works correctly", {
expect_true(is.writeable(tempdir()))
tf <- tempfile()
expect_error(is.writeable(tf)) # file doesn't exist yet
cat("foo",... | 1,130 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-on-failure.R | context("on-failure")
test_that("on_failure should work", {
is_red <- function(x) {x == "red"}
on_failure(is_red) <- function(call, env) {
paste0(deparse(call$x), " is not red")
}
res <- see_if(is_red("blue"))
expect_false(res[[1]])
expect_identical(attr(res, "msg"), '"blue" is not red')
})
| 314 | gpl-3.0 |
assertthat | cran-assertthat-b28a7b8/tests/testthat/test-scalar.R | context("Scalar assertions")
test_that("is.scalar works correctly", {
expect_true(is.scalar(1))
expect_true(is.scalar(-1))
expect_true(is.scalar(1.5))
expect_false(is.scalar(1:5))
expect_true(is.scalar('a'))
expect_false(is.scalar(c('a', 'b')))
expect_true(is.scalar(TRUE))
expect_false(is.scalar(c(TRUE... | 1,971 | gpl-3.0 |
devtools | cran-devtools-945c660/R/R.R | #' Environment variables to set when calling R
#'
#' Devtools sets a number of environmental variables to ensure consistent
#' between the current R session and the new session, and to ensure that
#' everything behaves the same across systems. It also suppresses a common
#' warning on windows, and sets `NOT_CRAN` so yo... | 1,099 | mit |
devtools | cran-devtools-945c660/R/active.R | find_active_file <- function(arg = "file", call = parent.frame()) {
if (!is_rstudio_running()) {
cli::cli_abort("Argument {.arg {arg}} is missing, with no default", call = call)
}
normalizePath(rstudioapi::getSourceEditorContext()$path)
}
find_test_file <- function(path, call = parent.frame()) {
type <- te... | 1,385 | mit |
devtools | cran-devtools-945c660/R/bash.R | #' Open bash shell in package directory.
#'
#' @template devtools
#' @export
bash <- function(pkg = ".") {
pkg <- as.package(pkg)
withr::with_dir(pkg$path, system("bash"))
}
| 179 | mit |
devtools | cran-devtools-945c660/R/build-manual.R | #' Create package pdf manual
#'
#' @template devtools
#' @param path path in which to produce package manual.
#' If `NULL`, defaults to the parent directory of the package.
#'
#' @seealso [Rd2pdf()]
#' @export
build_manual <- function(pkg = ".", path = NULL) {
pkg <- as.package(pkg)
path <- path %||% path_dir(pkg... | 715 | mit |
devtools | cran-devtools-945c660/R/build-readme.R | #' Build a Rmarkdown files package
#'
#' `build_rmd()` is a wrapper around [rmarkdown::render()] that first installs
#' a temporary copy of the package, and then renders each `.Rmd` in a clean R
#' session. `build_readme()` locates your `README.Rmd` and builds it into a
#' `README.md`
#'
#' @param files The Rmarkdown f... | 2,024 | mit |
devtools | cran-devtools-945c660/R/build-site.R | #' Execute \pkg{pkgdown} build_site in a package
#'
#' `build_site()` is a shortcut for [pkgdown::build_site()], it generates the
#' static HTML documentation.
#'
#' @param path path to the package to build the static HTML.
#' @param ... additional arguments passed to [pkgdown::build_site()]
#' @inheritParams instal... | 907 | mit |
devtools | cran-devtools-945c660/R/check-devtools.R | #' Custom devtools release checks.
#'
#' This function performs additional checks prior to release. It is called
#' automatically by [release()].
#'
#' @template devtools
#' @keywords internal
#' @export
release_checks <- function(pkg = ".", built_path = NULL) {
pkg <- as.package(pkg)
cat_rule(paste0("Running addit... | 3,564 | mit |
devtools | cran-devtools-945c660/R/check-doc.R | #' Check documentation, as `R CMD check` does.
#'
#' This function attempts to run the documentation related checks in the
#' same way that `R CMD check` does. Unfortunately it can't run them
#' all because some tests require the package to be loaded, and the way
#' they attempt to load the code conflicts with how devt... | 1,843 | mit |
devtools | cran-devtools-945c660/R/check-git.R | #' Git checks.
#'
#' This function performs Git checks checks prior to release. It is called
#' automatically by [release()].
#'
#' @template devtools
#' @keywords internal
git_checks <- function(pkg = ".") {
pkg <- as.package(pkg)
cat_rule(paste0("Running Git checks for ", pkg$package))
git_report_branch(pkg)
... | 664 | mit |
devtools | cran-devtools-945c660/R/check-mac.R | #' Check macOS package
#'
#' This function works by bundling source package, and then uploading to
#' <https://mac.r-project.org/macbuilder/submit.html>. This function returns a
#' link to the page with the check results.
#'
#' @template devtools
#' @inheritParams check_win
#' @param dep_pkgs Additional custom depende... | 2,096 | mit |
devtools | cran-devtools-945c660/R/check-win.R | #' Build windows binary package.
#'
#' This function works by bundling source package, and then uploading to
#' <https://win-builder.r-project.org/>. Once building is complete you'll
#' receive a link to the built package in the email address listed in the
#' maintainer field. It usually takes around 30 minutes. As a... | 4,696 | mit |
devtools | cran-devtools-945c660/R/check.R | #' Build and check a package
#'
#' @description
#' `check()` automatically builds and checks a source package, using all known
#' best practices. `check_built()` checks an already-built package.
#'
#' Passing `R CMD check` is essential if you want to submit your package to
#' CRAN: you must not have any ERRORs or WARNI... | 8,581 | mit |
devtools | cran-devtools-945c660/R/create.R | #' Create a package
#'
#' @param path A path. If it exists, it is used. If it does not exist, it is
#' created, provided that the parent path exists.
#' @param ... Additional arguments passed to [usethis::create_package()]
#' @inheritParams usethis::create_package
#' @return The path to the created package, invisibly... | 431 | mit |
devtools | cran-devtools-945c660/R/dev-mode.R | #' Activate and deactivate development mode.
#'
#' When activated, `dev_mode` creates a new library for storing installed
#' packages. This new library is automatically created when `dev_mode` is
#' activated if it does not already exist.
#' This allows you to test development packages in a sandbox, without
#' interfer... | 2,070 | mit |
devtools | cran-devtools-945c660/R/devtools-package.R | #' @section Package options:
#'
#' Devtools uses the following [options()] to configure behaviour:
#'
#' \itemize{
#' \item `devtools.path`: path to use for [dev_mode()]
#'
#' \item `devtools.name`: your name, used when signing draft
#' emails.
#'
#' \item `devtools.install.args`: a string giving extra argume... | 625 | mit |
devtools | cran-devtools-945c660/R/document.R | #' Use roxygen to document a package.
#'
#' This function is a wrapper for the [roxygen2::roxygenize()]
#' function from the roxygen2 package. See the documentation and vignettes of
#' that package to learn how to use roxygen.
#'
#' @template devtools
#' @inheritParams roxygen2::roxygenise
#' @param quiet if `TRUE` sup... | 1,028 | mit |
devtools | cran-devtools-945c660/R/git.R | uses_git <- function(path = ".") {
dir_exists(path(path, ".git"))
}
git_branch <- function(path = ".") {
withr::local_dir(path)
system2("git", c("rev-parse", "--abbrev-ref", "HEAD"), stdout = TRUE)
}
git_uncommitted <- function(path = ".") {
withr::local_dir(path)
out <- system2("git", c("status", "--porc... | 367 | mit |
devtools | cran-devtools-945c660/R/has-tests.R | #' Was devtools installed with tests?
#'
#' @keywords internal
#' @export
has_tests <- function() {
test_path <- tryCatch(
path_package("devtools", "tests"),
error = function(e) NULL
)
!is.null(test_path)
}
| 222 | mit |
devtools | cran-devtools-945c660/R/install.R | #' Install a local development package.
#'
#' Uses `R CMD INSTALL` to install the package. Will also try to install
#' dependencies of the package from CRAN, if they're not already installed.
#'
#' If `quick = TRUE`, installation takes place using the current package
#' directory. If you have compiled code, this means ... | 7,011 | mit |
devtools | cran-devtools-945c660/R/lint.R | #' Lint all source files in a package
#'
#' The default linters correspond to the style guide at
#' <https://style.tidyverse.org/>, however it is possible to override any or all
#' of them using the `linters` parameter.
#'
#' @template devtools
#' @param cache Store the lint results so repeated lints of the same conten... | 862 | mit |
devtools | cran-devtools-945c660/R/missing-s3.R | #' Find missing s3 exports.
#'
#' The method is heuristic - looking for objs with a period in their name.
#'
#' @template devtools
#' @export
missing_s3 <- function(pkg = ".") {
pkg <- as.package(pkg)
loaded <- load_all(pkg$path)
# Find all S3 methods in package
objs <- ls(envir = loaded$env)
is_s3 <- functi... | 581 | mit |
devtools | cran-devtools-945c660/R/package-deps.R | #' @importFrom pkgload parse_deps
#' @export
pkgload::parse_deps
#' @importFrom pkgload check_dep_version
#' @export
pkgload::check_dep_version
| 145 | mit |
devtools | cran-devtools-945c660/R/package.R | #' Coerce input to a package.
#'
#' Possible specifications of package:
#' \itemize{
#' \item path
#' \item package object
#' }
#' @param x object to coerce to a package
#' @param create `r lifecycle::badge("deprecated")` Hasn't worked for some time.
#' @export
#' @keywords internal
as.package <- function(x = NULL,... | 2,311 | mit |
devtools | cran-devtools-945c660/R/pkgbuild.R | #' @template devtools
#' @param path Path in which to produce package. If `NULL`, defaults to
#' the parent directory of the package.
#' @inherit pkgbuild::build
#' @note The default `manual = FALSE` is not suitable for a CRAN
#' submission, which may require `manual = TRUE`. Even better, use
#' [submit_cran()]... | 1,149 | mit |
devtools | cran-devtools-945c660/R/pkgload.R | #' @inherit pkgload::load_all
#' @param ... Additional arguments passed to [pkgload::load_all()].
#' @export
load_all <- function(path = ".", reset = TRUE, recompile = FALSE,
export_all = TRUE, helpers = TRUE, quiet = FALSE, ...) {
if (inherits(path, "package")) {
path <- path$path
}
sav... | 616 | mit |
devtools | cran-devtools-945c660/R/r-hub.R |
#' Run CRAN checks for package on R-hub
#'
#' It runs [build()] on the package, with the arguments specified
#' in `args`, and then submits it to the R-hub builder at
#' <https://builder.r-hub.io>. The `interactive` option controls
#' whether the function waits for the check output. Regardless, after the
#' check is c... | 2,256 | mit |
devtools | cran-devtools-945c660/R/release.R | #' Release package to CRAN.
#'
#' Run automated and manual tests, then post package to CRAN.
#'
#' The package release process will:
#'
#' \itemize{
#' \item Confirm that the package passes `R CMD check` on relevant platforms
#' \item Confirm that important files are up-to-date
#' \item Build the package
#' \it... | 10,081 | mit |
devtools | cran-devtools-945c660/R/reload.R | #' Unload and reload package.
#'
#' This attempts to unload and reload an _installed_ package. If the package is
#' not loaded already, it does nothing. It's not always possible to cleanly
#' unload a package: see the caveats in [unload()] for some of the potential
#' failure points. If in doubt, restart R and reload t... | 1,300 | mit |
devtools | cran-devtools-945c660/R/remotes.R | #' @importFrom ellipsis check_dots_used
with_ellipsis <- function(fun) {
b <- body(fun)
f <- function(...) {
ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
!! b
}
f <- rlang::expr_interp(f)
body(fun) <- body(f)
fun
}
with_pkgbuild_build_tools <- function(f... | 3,438 | mit |
devtools | cran-devtools-945c660/R/revdep.R | #' Reverse dependency tools.
#'
#' Tools to check and notify maintainers of all CRAN and Bioconductor
#' packages that depend on the specified package.
#'
#' The first run in a session will be time-consuming because it must download
#' all package metadata from CRAN and Bioconductor. Subsequent runs will
#' be faster.
... | 2,907 | mit |
devtools | cran-devtools-945c660/R/run-examples.R | #' Run all examples in a package.
#'
#' One of the most frustrating parts of `R CMD check` is getting all of your
#' examples to pass - whenever one fails you need to fix the problem and then
#' restart the whole process. This function makes it a little easier by
#' making it possible to run all examples from an R fun... | 3,384 | mit |
devtools | cran-devtools-945c660/R/run-source.R | #' Run a script through some protocols such as http, https, ftp, etc.
#'
#' If a SHA-1 hash is specified with the `sha1` argument, then this
#' function will check the SHA-1 hash of the downloaded file to make sure it
#' matches the expected value, and throw an error if it does not match. If the
#' SHA-1 hash is not sp... | 5,727 | mit |
devtools | cran-devtools-945c660/R/save-all.R | #' Save all documents in an active IDE session.
#'
#' Helper function wrapping IDE-specific calls to save all documents in the
#' active session. In this form, callers of `save_all()` don't need to
#' execute any IDE-specific code. This function can be extended to include
#' other IDE implementations of their equivalen... | 494 | mit |
devtools | cran-devtools-945c660/R/session-info.R | #' Return a vector of names of attached packages
#' @export
#' @keywords internal
#' @return A data frame with columns package and path, giving the name of
#' each package and the path it was loaded from.
loaded_packages <- function() {
attached <- data.frame(
package = search(),
path = searchpaths(),
s... | 947 | mit |
devtools | cran-devtools-945c660/R/show-news.R | #' Show package news
#'
#' @template devtools
#' @param latest if `TRUE`, only show the news for the most recent
#' version.
#' @param ... other arguments passed on to `news`
#' @export
show_news <- function(pkg = ".", latest = TRUE, ...) {
pkg <- as.package(pkg)
news_path <- path(pkg$path, "NEWS")
if (!file_e... | 752 | mit |
devtools | cran-devtools-945c660/R/sitrep.R | # Supress R CMD check note
#' @importFrom memoise memoise
NULL
rstudio_version_string <- function() {
if (!is_rstudio_running()) {
return(character())
}
rvi <- rstudioapi::versionInfo()
rvi$long_version %||% as.character(rvi$version)
}
check_for_rstudio_updates <- function(os = tolower(Sys.info()[["sysnam... | 5,602 | mit |
devtools | cran-devtools-945c660/R/spell-check.R | #' Spell checking
#'
#' Runs a spell check on text fields in the package description file, manual
#' pages, and optionally vignettes. Wraps the \link[spelling:spell_check_package]{spelling}
#' package.
#'
#' @export
#' @rdname spell_check
#' @template devtools
#' @param vignettes also check all `rmd` and `rnw` files in... | 674 | mit |
devtools | cran-devtools-945c660/R/test.R | #' Execute testthat tests in a package
#'
#' @description
#' * `test()` runs all tests in a package. It's a shortcut for
#' [testthat::test_dir()]
#' * `test_active_file()` runs `test()` on the active file.
#' * `test_coverage()` computes test coverage for your package. It's a
#' shortcut for [covr::package_coverag... | 4,930 | mit |
devtools | cran-devtools-945c660/R/uninstall.R | #' Uninstall a local development package
#'
#' Uses `remove.packages()` to uninstall the package. To uninstall a package
#' from a non-default library, use in combination with [withr::with_libpaths()].
#'
#' @inheritParams install
#' @param unload if `TRUE` (the default), ensures the package is unloaded, prior
#' to ... | 861 | mit |
devtools | cran-devtools-945c660/R/usethis.R | # Some helpers around usethis functions
# we need to import some usethis function so the namespace is loaded when
# devtools is loaded, but not attached.
#' @importFrom usethis use_test
NULL
usethis_use_testthat <- function(pkg) {
usethis::local_project(pkg$path, quiet = FALSE)
usethis::use_testthat()
}
usethis_... | 619 | mit |
devtools | cran-devtools-945c660/R/utils.R | compact <- function(x) {
is_empty <- vapply(x, function(x) length(x) == 0, logical(1))
x[!is_empty]
}
"%||%" <- function(a, b) if (!is.null(a)) a else b
"%:::%" <- function(p, f) {
get(f, envir = asNamespace(p))
}
is_windows <- isTRUE(.Platform$OS.type == "windows")
sort_ci <- function(x) {
withr::with_coll... | 917 | mit |
devtools | cran-devtools-945c660/R/vignette-r.R | copy_vignettes <- function(pkg, keep_md) {
pkg <- as.package(pkg)
usethis_use_directory(pkg, "doc", ignore = TRUE)
usethis_use_git_ignore(pkg, "/doc/")
doc_dir <- path(pkg$path, "doc")
vignettes <- tools::pkgVignettes(dir = pkg$path, output = TRUE, source = TRUE)
if (length(vignettes$docs) == 0) {
re... | 1,731 | mit |
devtools | cran-devtools-945c660/R/vignettes.R | #' Build package vignettes.
#'
#' Builds package vignettes using the same algorithm that `R CMD build`
#' does. This means including non-Sweave vignettes, using makefiles (if
#' present), and copying over extra files. The files are copied in the 'doc'
#' directory and an vignette index is created in 'Meta/vignette.rds'... | 4,488 | mit |
devtools | cran-devtools-945c660/R/wd.R | #' Set working directory.
#'
#' @template devtools
#' @param path path within package. Leave empty to change working directory
#' to package directory.
#' @export
wd <- function(pkg = ".", path = "") {
pkg <- as.package(pkg)
path <- path(pkg$path, path)
if (!file_exists(path)) {
cli::cli_abort("{.path {pat... | 434 | mit |
devtools | cran-devtools-945c660/R/zzz.R | #' @importFrom utils available.packages contrib.url install.packages
#' installed.packages modifyList packageDescription
#' packageVersion remove.packages
#' @importFrom cli cat_rule cat_bullet
#' @import fs
NULL
#' Deprecated Functions
#'
#' These functions are Deprecated in this release of devtools, they will be... | 764 | mit |
devtools | cran-devtools-945c660/tests/spelling.R | if(requireNamespace('spelling', quietly = TRUE))
spelling::spell_check_test(vignettes = TRUE, error = FALSE,
skip_on_cran = TRUE)
| 161 | mit |
devtools | cran-devtools-945c660/tests/testthat.R | library(testthat)
library(devtools)
test_check("devtools")
| 60 | mit |
devtools | cran-devtools-945c660/tests/testthat/helper.R | # This is a VERY trimmed down version of create_local_thing from usethis
local_package_create <- function(envir = parent.frame()) {
dir <- withr::local_tempdir(.local_envir = envir)
usethis::ui_silence({
create_package(dir, rstudio = FALSE, open = FALSE, check_name = FALSE)
})
dir
}
local_package_copy <-... | 477 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-active.R | test_that("find_active_file() gives useful error if no RStudio", {
expect_snapshot(find_active_file(), error = TRUE)
})
test_that("fails if can't find tests", {
expect_snapshot(error = TRUE, {
find_test_file("R/foo.blah")
find_test_file("R/foo.R")
})
})
test_that("can determine file type", {
expect_eq... | 803 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-build-readme.R | test_that("can build README in root directory", {
skip_on_cran()
pkg <- local_package_create()
suppressMessages(usethis::with_project(pkg, use_readme_rmd()))
suppressMessages(build_readme(pkg))
expect_true(file_exists(path(pkg, "README.md")))
expect_false(file_exists(path(pkg, "README.html")))
})
test_th... | 1,197 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-build-site.R | test_that("Package pkgdown site can be built ", {
# This test requires internet
skip_if_offline()
skip_on_cran()
destination <- path(tempdir(), "testPkgdown", "docs")
build_output <- capture.output({
build_site(
path = "testPkgdown",
override = list(destination = destination)
)
}, type... | 933 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-check-doc.R | test_that("check_man works", {
# tools:::.check_Rd_xrefs which is called by `check_man()` assumes the base
# and recommended packages will all be in the library path, which is not the
# case during R CMD check, so we only run these tests interactively
skip_if_not(interactive())
pkg <- local_package_create()... | 551 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-check-win.R | test_that("change_maintainer_email checks fields", {
path <- withr::local_tempfile()
desc <- desc::desc(text = "")
desc$write(path)
expect_snapshot(change_maintainer_email(path, "x@example.com"), error = TRUE)
desc <- desc::desc(text = c(
"Authors@R: person('x', 'y')",
"Maintainer: foo <foo@example.... | 433 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-check.R | test_that("can determine when to document", {
expect_false(can_document(list()))
# TODO: switch to expect_snapshot()
suppressMessages(expect_message(
expect_false(can_document(list(roxygennote = "15.0.00"))),
"doesn't match required"
))
expect_true(can_document(list(roxygennote = packageVersion("roxyg... | 739 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-install.R | library(mockery)
local({
pkg <- fs::path_real(local_package_create())
path2char <- function(x) {
if (inherits(x, "fs_path")) {
as.character(x)
} else {
x
}
}
expect_passes_args <- function(fn, stub, input_args = list(), expected_args) {
mck <- mockery::mock(NULL)
mockery::stub(fn, stub, mck)
ca... | 2,933 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-package.R | test_that("package_file() gives useful errors", {
expect_snapshot(error = TRUE, {
package_file(path = 1)
package_file(path = "doesntexist")
package_file(path = "/")
})
})
test_that("create argument is deprecated", {
path <- local_package_create()
expect_snapshot(x <- as.package(path, create = TRUE)... | 325 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-reload.R | test_that("reload works", {
withr::local_temp_libpaths()
pkg <- as.package(test_path("testTest"))
pkg_name <- pkg$package
install(pkg, quiet = TRUE)
on.exit(unload(pkg$package), add = TRUE)
expect_false(is_loaded(pkg))
# Do nothing if the package is not loaded
expect_error(reload(pkg, quiet = TRUE),... | 788 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-run-examples.R | test_that("Can run an example", {
pkg <- "testHelp"
expect_output(
suppressMessages(run_examples(pkg = pkg, document = FALSE)),
"You called foofoo.",
fixed = TRUE
)
})
| 186 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-run-source.R | test_that("gist containing single file works unambiguously", {
skip_if_offline()
skip_on_cran()
skip_on_ci()
a <- 10
source_gist(
"a65ddd06db40213f1a921237c55defbe",
sha1 = "f176f5e1fe05b69b1ef799fdd1e4bac6341aff51",
local = environment(),
quiet = TRUE
)
expect_equal(a, 1)
})
test_that("... | 1,560 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-sitrep.R | test_that("check_for_rstudio_updates", {
skip_if_offline()
skip_on_cran()
# the IDE ends up calling this with `os = "mac"` on macOS, but we would send
# "darwin" in that case, so I test with "darwin"
# also mix in some "windows"
# returns nothing rstudio not available
expect_null(check_for_rstudio_updat... | 1,721 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-test.R | test_test <- function(...) {
suppressMessages(test(..., reporter = "silent"))
}
test_test_active_file <- function(...) {
suppressMessages(test_active_file(..., reporter = "silent"))
}
test_that("Package can be tested with testthat not on search path", {
pkg1 <- test_path("testTest")
pkg2 <- test_path("testTest... | 1,504 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-uninstall.R | test_that("uninstall() unloads and removes from library", {
withr::local_temp_libpaths()
# Install package
install(test_path("testHelp"), quiet = TRUE)
expect_true(require(testHelp, quietly = TRUE))
expect_true("testHelp" %in% loaded_packages()$package)
# Uninstall package
uninstall(test_path("testHelp"... | 466 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-utils.R | test_that("case-insensitive sort order", {
expect_equal(sort_ci(rev(letters)), letters)
expect_equal(sort_ci(rev(LETTERS)), LETTERS)
expect_equal(sort_ci(c(letters[1:3], LETTERS[1:3])), c("A", "a", "B", "b", "C", "c"))
})
| 228 | mit |
devtools | cran-devtools-945c660/tests/testthat/test-vignettes.R | test_that("Sweave vignettes copied into doc", {
if (!pkgbuild::has_latex()) {
skip("pdflatex not available")
}
pkg <- local_package_copy(test_path("testVignettes"))
suppressMessages(build_vignettes(pkg, quiet = TRUE))
expect_setequal(
path_file(dir_ls(path(pkg, "doc"))),
c("new.pdf", "new.R", "n... | 1,908 | mit |
devtools | cran-devtools-945c660/tests/testthat/testCheckExtrafile/R/a.R | #' A number.
#' @export
a <- 1
| 31 | mit |
devtools | cran-devtools-945c660/tests/testthat/testError/R/error.R | f <- function() {
5 * 10
}
stop("This is an error!") # nolint
| 67 | mit |
devtools | cran-devtools-945c660/tests/testthat/testHelp/R/foofoo.R | #' Test function for help
#'
#' The purpose of this function is to test out \code{help} and \code{?} from
#' devtools.
#'
#' @examples
#' stopifnot(foofoo() == 'You called foofoo.')
#' @export
foofoo <- function() "You called foofoo."
| 235 | mit |
devtools | cran-devtools-945c660/tests/testthat/testMissingNsObject/R/a.R | a <- 1
| 7 | mit |
devtools | cran-devtools-945c660/tests/testthat/testPkgdown/R/pkgdown-test-test.R |
#' pkgdown_test_test
#'
#' @param x marks the spot
#'
#' @return FALSE
#' @export
#'
pkgdown_test_test <- function(x) {
return(FALSE)
}
| 139 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTest/R/dummy.R | 1 | mit | |
devtools | cran-devtools-945c660/tests/testthat/testTest/tests/testthat.R | library(testthat)
library(testTest)
test_check("testTest")
| 60 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTest/tests/testthat/test-dummy.R | test_that("multiplication works", {
expect_equal(2 * 2, 4)
})
| 64 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTest/tests/testthat/test-envvar.R | test_that("TESTTHAT_PKG environment variable is set", {
expect_equal(Sys.getenv("TESTTHAT_PKG"), "testTest")
})
| 114 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTestWithDepends/tests/testthat.R | library(testthat)
library(testTestWithDepends)
test_check("testTestWithDepends")
| 82 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTestWithDepends/tests/testthat/test-dummy.R | test_that("multiplication works", {
expect_equal(2 * 2, 4)
})
| 64 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTestWithFailure/R/dummy.R | 1 | mit | |
devtools | cran-devtools-945c660/tests/testthat/testTestWithFailure/tests/testthat.R | library(testthat)
library(testTest)
test_check("testTest")
| 60 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTestWithFailure/tests/testthat/test-fail.R | test_that("failing test", {
fail("Broken")
})
| 48 | mit |
devtools | cran-devtools-945c660/tests/testthat/testTestWithFailure/tests/testthat/test-warn.R | test_that("warning from test", {
warning("Beware!") # nolint
})
| 66 | mit |
End of preview.
CRAN packages dataset
R and Rmd source codes for CRAN packages.
The dataset has been constructed using the following steps:
- Downloaded latest version from all packages on CRAN (see last updated). The source code has been downloaded from the GitHub mirror.
- Identified the licenses from each package from their DESCRIPTION file, and classified each of them into some license_code. See the licenses.csv file.
- Extract R and Rmd source files from all packages and joined with the package LICENSES.
Datasets are provided as parquet files containing the following columns:
FileSystemDataset with 1 Parquet file
package: string
path: string
content: large_string
size: double
license: string
Last updated: Jun 6th 2023
Changelog
- v1: Initial version
- dev: added all CRAN files and a license field that allows filtering out per license. Also removed some unused columns.
- Downloads last month
- 58