quanteda / quanteda

An R package for the Quantitative Analysis of Textual Data
https://quanteda.io
GNU General Public License v3.0
840 stars 188 forks source link

Fix CRAN warnings re textplot_network() #1774

Closed kbenoit closed 4 years ago

kbenoit commented 4 years ago

From https://cran.r-project.org/web/checks/check_results_quanteda.html

Platform: r-devel-linux-x86_64-debian-gcc

checking tests ... [167s/220s] ERROR
  Running ‘spelling.R’ [0s/1s]
  Running ‘testthat.R’ [166s/219s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > Sys.setenv("R_TESTS" = "")
  >
  > library(testthat)
  > library(quanteda)
  Package version: 1.5.1
  Parallel computing: 2 of 32 threads used.
  See https://quanteda.io for tutorials and examples.

  Attaching package: 'quanteda'

  The following object is masked from 'package:utils':

      View

  >
  > Sys.setenv("_R_CHECK_LENGTH_1_CONDITION_" = TRUE)
  >
  > ops <- quanteda_options()
  > quanteda_options(reset = TRUE)
  >
  > test_check("quanteda")
  ── 1. Error: as.igraph.fcm works with window (@test-fcm.R#285) ────────────────
  the condition has length > 1
  Backtrace:
    1. testthat::expect_silent(as.igraph(mat, min_freq = 3, omit_isolated = TRUE))
   10. quanteda:::as.igraph.fcm(mat, min_freq = 3, omit_isolated = TRUE)
   11. igraph::graph_from_adjacency_matrix(x, ...)
   12. igraph:::graph.adjacency.sparse(...)
   13. igraph::graph(n = vc, edges, directed = (mode == "directed"))

  ── 2. Error: test textplot_network (@test-textplot_network.R#7) ───────────────
  the condition has length > 1
  Backtrace:
    1. testthat::expect_silent(...)
   10. quanteda:::textplot_network.fcm(...)
   12. sna::gplot.layout.fruchtermanreingold(net, NULL)
   13. sna::symmetrize(d, rule = "weak", return.as.edgelist = TRUE)
   14. sna::as.edgelist.sna(mats)

  ── 3. Error: test textplot_network works with vectorlized argument (@test-textpl
  the condition has length > 1
  Backtrace:
    1. testthat::expect_silent(...)
   10. quanteda:::textplot_network.fcm(...)
   12. sna::gplot.layout.fruchtermanreingold(net, NULL)
   13. sna::symmetrize(d, rule = "weak", return.as.edgelist = TRUE)
   14. sna::as.edgelist.sna(mats)

  ── 4. Error: test textplot_network font-selection (@test-textplot_network.R#38)
  the condition has length > 1
  Backtrace:
    1. testthat::expect_silent(...)
   10. quanteda:::textplot_network.fcm(testfcm, offset = 0.1, vertex_labelfont = "serif")
   12. sna::gplot.layout.fruchtermanreingold(net, NULL)
   13. sna::symmetrize(d, rule = "weak", return.as.edgelist = TRUE)
   14. sna::as.edgelist.sna(mats)
kbenoit commented 4 years ago

Seems to be a problem we inherited from igraph:

https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/igraph-00check.html

Solution would be to not test on that platform, and dontcheck the examples for textplot_network().