Skip to content

Commit

Permalink
remove dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed May 1, 2024
1 parent b8fb5f1 commit 69b6e10
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 306 deletions.
6 changes: 1 addition & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ Depends:
R (>= 4.0.0)
Imports:
cli (>= 3.4.0),
Matrix,
rlang (>= 1.1.0),
tibble,
vctrs
rlang (>= 1.1.0)
Suggests:
rsparse,
testthat (>= 3.0.0),
withr
Config/Needs/website: rmarkdown
Expand Down
9 changes: 0 additions & 9 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
# Generated by roxygen2: do not edit by hand

S3method(format,sparse_vector)
S3method(vec_arith,sparse_vector)
S3method(vec_math,sparse_vector)
S3method(vec_ptype_abbr,sparse_vector)
export(new_sparse_real)
export(new_sparse_vector)
export(sparse_to_tibble)
export(sparse_vector)
export(tibble_to_sparse)
import(rlang)
import(vctrs)
useDynLib(sparsevctrs, .registration = TRUE)
13 changes: 12 additions & 1 deletion R/altrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ new_sparse_real <- function(value, position, length) {
}

if (!is.integer(position)) {
position <- vec_cast(position, integer())
if (any(round(position) != position)) {
offenders <- which(round(position) != position)

cli::cli_abort(
c(
x = "{.arg position} must contain integer values.",
i = "Non-integer values at index: {offenders}."
)
)
}

position <- as.integer(position)
}

len_value <- length(value)
Expand Down
79 changes: 0 additions & 79 deletions R/convert.R

This file was deleted.

4 changes: 0 additions & 4 deletions R/sparsevctrs-package.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#' @keywords internal
"_PACKAGE"

#' Internal vctrs methods
#'
#' @import vctrs
#' @import rlang
#' @keywords internal
#' @name sparsevctrs-vctrs
NULL

## usethis namespace: start
Expand Down
91 changes: 0 additions & 91 deletions R/vector.R

This file was deleted.

25 changes: 0 additions & 25 deletions man/new_sparse_vector.Rd

This file was deleted.

27 changes: 0 additions & 27 deletions man/sparse_to_tibble.Rd

This file was deleted.

25 changes: 0 additions & 25 deletions man/sparse_vector.Rd

This file was deleted.

9 changes: 0 additions & 9 deletions man/sparsevctrs-vctrs.Rd

This file was deleted.

28 changes: 0 additions & 28 deletions man/tibble_to_sparse.Rd

This file was deleted.

6 changes: 3 additions & 3 deletions tests/testthat/_snaps/altrep.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
new_sparse_real(1, 1.5, 1)
Condition
Error in `new_sparse_real()`:
! Can't convert from `position` <double> to <integer> due to loss of precision.
* Locations: 1
x `position` must contain integer values.
i Non-integer values at index: 1.

---

Expand Down Expand Up @@ -86,7 +86,7 @@
Code
new_sparse_real(1, NaN, 1)
Condition
Error in `if (len_position > 0 && max(position) > length) ...`:
Error in `if (any(round(position) != position)) ...`:
! missing value where TRUE/FALSE needed

---
Expand Down

0 comments on commit 69b6e10

Please sign in to comment.