Skip to content

Commit fbafd13

Browse files
authored
Updates for upcoming Matrix release (#218)
* Updates for upcoming Matrix release * Update NEWS
1 parent 5d31908 commit fbafd13

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# tidytext (development version)
22

3+
* Updated the tidy method for a quanteda `dfm` because of the upcoming release of Matrix (#218)
4+
35
# tidytext 0.3.3
46

57
* `scale_x/y_reordered()` now uses a function `labels` as its main input (#200)

R/sparse_tidiers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tidy.TermDocumentMatrix <- function(x, ...) {
4444
#' @rdname tdm_tidiers
4545
#' @export
4646
tidy.dfm <- tidy.dfmSparse <- function(x, ...) {
47-
triplets <- Matrix::summary(methods::as(x, "dgTMatrix"))
47+
triplets <- Matrix::summary(methods::as(x, "TsparseMatrix"))
4848
ret <- tidy_triplet(x, triplets)
4949
colnames(ret) <- c("document", "term", "count")
5050
ret

tests/testthat/test-sparse-casters.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ test_that("Can cast tables into a sparse dfm", {
7575
expect_equal(as.numeric(d[1, 1]), 1)
7676
expect_equal(as.numeric(d[2, 3]), 4)
7777
})
78+

tidytext.Rproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ StripTrailingWhitespace: Yes
1717

1818
BuildType: Package
1919
PackageUseDevtools: Yes
20-
PackageCleanBeforeInstall: Yes
2120
PackageInstallArgs: --no-multiarch --with-keep.source
2221
PackageRoxygenize: rd,collate,namespace

0 commit comments

Comments
 (0)