Relaxing R version requirement

Standard

Until quanteda v1.1, our users needed to have R 3.4.0 installed, but we relax the requirement to R 3.1.0, because people working in companies or other large organizations often do not have latest version of R in their computers, and therefore cannot use our package. To investigate why quanteda requires R 3.4.0 quickly, I wrote a function called print_depends():

require(stringi)

print_depends <- function(package, level = 0) {
    desc <- packageDescription(package)
    if ("Depends" %in% names(desc)) {
        dep <- stri_trim_both(desc$Depends)
        r <- stri_extract_first_regex(dep, 'R \\(.*?\\)')
        if (is.na(r)) r <- ''
        cat(strrep('  ', level), package, ": " , r, "\n", sep = '')
        if ("Imports" %in% names(desc)) {
            imp <- paste0(desc$Depends, ', ', desc$Imports)
            if (r != '') 
                imp <- stri_replace_first_fixed(imp, r, '')
            imp <- stri_replace_all_regex(imp, ' \\(.*?\\)', '')
            imp <- unlist(stri_split_regex(imp, ','))
            imp <- stri_trim_both(imp)
            imp <- imp[imp != '']
            for(i in imp) {
                print_depends(i, level + 1)
            }
        }
    }
}
print_depends('quanteda')

The output showed that quanteda needs R 3.4.0 only because slam requires. Our package depends on slam because of wordcloud.

quanteda: R (>= 3.4.0)
  extrafont: R (>= 2.15)
    extrafontdb: R (>= 2.14)
    Rttf2pt1: R (>= 2.15)
  digest: R (>= 2.4.1)
  Matrix: R (>= 3.0.1)
    lattice: R (>= 3.0.0)
  wordcloud: 
    RColorBrewer: R (>= 2.0.0)
    slam: R (>= 3.4.0)
    Rcpp: R (>= 3.0.0)
  sna: R (>= 2.0.0)
  network: R (>= 2.10)
  ggrepel: R (>= 3.0.0)
    ggplot2: R (>= 3.1)
      digest: R (>= 2.4.1)
      gtable: R (>= 2.14)
      MASS: R (>= 3.1.0)
      plyr: R (>= 3.1.0)
        Rcpp: R (>= 3.0.0)
      reshape2: R (>= 3.1)
        plyr: R (>= 3.1.0)
          Rcpp: R (>= 3.0.0)
        Rcpp: R (>= 3.0.0)
        stringr: R (>= 3.1)
          glue: R (>= 3.1)
          stringi: R (>= 2.14)
      scales: R (>= 2.13)
        RColorBrewer: R (>= 2.0.0)
        dichromat: R (>= 2.10)
        plyr: R (>= 3.1.0)
          Rcpp: R (>= 3.0.0)
        Rcpp: R (>= 3.0.0)
        R6: R (>= 3.0)
        viridisLite: R (>= 2.10)
      tibble: R (>= 3.1.0)
        cli: R (>= 2.10)
        rlang: R (>= 3.1.0)
      lazyeval: R (>= 3.1.0)
    Rcpp: R (>= 3.0.0)
    scales: R (>= 2.13)
      RColorBrewer: R (>= 2.0.0)
      dichromat: R (>= 2.10)
      plyr: R (>= 3.1.0)
        Rcpp: R (>= 3.0.0)
      Rcpp: R (>= 3.0.0)
      R6: R (>= 3.0)
      viridisLite: R (>= 2.10)
  RcppParallel: R (>= 3.0.2)
  RSpectra: R (>= 3.0.2)
    Matrix: R (>= 3.0.1)
      lattice: R (>= 3.0.0)
    Rcpp: R (>= 3.0.0)
  stringi: R (>= 2.14)
  ggplot2: R (>= 3.1)
    digest: R (>= 2.4.1)
    gtable: R (>= 2.14)
    MASS: R (>= 3.1.0)
    plyr: R (>= 3.1.0)
      Rcpp: R (>= 3.0.0)
    reshape2: R (>= 3.1)
      plyr: R (>= 3.1.0)
        Rcpp: R (>= 3.0.0)
      Rcpp: R (>= 3.0.0)
      stringr: R (>= 3.1)
        glue: R (>= 3.1)
        stringi: R (>= 2.14)
    scales: R (>= 2.13)
      RColorBrewer: R (>= 2.0.0)
      dichromat: R (>= 2.10)
      plyr: R (>= 3.1.0)
        Rcpp: R (>= 3.0.0)
      Rcpp: R (>= 3.0.0)
      R6: R (>= 3.0)
      viridisLite: R (>= 2.10)
    tibble: R (>= 3.1.0)
      cli: R (>= 2.10)
      rlang: R (>= 3.1.0)
    lazyeval: R (>= 3.1.0)
  XML: R (>= 2.13.0)
  lubridate: R (>= 3.0.0)
    stringr: R (>= 3.1)
      glue: R (>= 3.1)
      stringi: R (>= 2.14)
    Rcpp: R (>= 3.0.0)
  spacyr: R (>= 3.0.0)
    data.table: R (>= 3.0.0)
    reticulate: R (>= 3.0)
      jsonlite: 
      Rcpp: R (>= 3.0.0)
  stopwords: R (>= 2.10)
    ISOcodes: R (>= 2.10.0)

Since we never use tm for text processing, we decided to write our own function for word cloud incorporating the publicly available code and drop tm from our dependencies. Since this change in v1.1.0, quanteda and other packages that depend on it (e.g. tidytext) can be installed only with R 3.1.0, which was released over three years ago. I hope
this change to make quantitative text analysis more accessible to R users, especially to those in the industry.

Leave a Reply

Your email address will not be published. Required fields are marked *