* using log directory ‘/data/gannet/ripley/R/packages/tests-LENGTH1/goldi.Rcheck’ * using R Under development (unstable) (2022-04-26 r82260) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘goldi/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘goldi’ version ‘1.0.1’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘goldi’ can be installed ... [64s/168s] OK * checking package directory ... OK * checking ‘build’ directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [12s/34s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of ‘data’ directory ... OK * checking data for non-ASCII characters ... OK * checking LazyData ... OK * checking data for ASCII and uncompressed saves ... OK * checking R/sysdata.rda ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK * checking pragmas in C/C++ headers and code ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ [5s/18s] [6s/19s] ERROR Running the tests in ‘tests/testthat.R’ failed. Complete output: > library(testthat) > library(goldi) Attaching package: 'goldi' The following object is masked from 'package:base': match > > test_check("goldi") ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- goldi --- call from context --- goldi(doc = doc, terms = "empty", output = output, lims = lims, log = log, object = TRUE, reader = "local", term_tdm = TDM.go.df) --- call from argument --- lims == "interactive" || lims == "i" --- R stacktrace --- where 1: goldi(doc = doc, terms = "empty", output = output, lims = lims, log = log, object = TRUE, reader = "local", term_tdm = TDM.go.df) where 2: eval_bare(expr, quo_get_env(quo)) where 3: quasi_label(enquo(object), label, arg = "object") where 4 at test-goldi.R#23: expect_equal(goldi(doc = doc, terms = "empty", output = output, lims = lims, log = log, object = TRUE, reader = "local", term_tdm = TDM.go.df), out) where 5: eval(code, test_env) where 6: eval(code, test_env) where 7: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() } }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error) where 8: doTryCatch(return(expr), name, parentenv, handler) where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]]) where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) where 11: doTryCatch(return(expr), name, parentenv, handler) where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) where 13: tryCatchList(expr, classes, parentenv, handlers) where 14: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() } }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { }) where 15: test_code(desc, code, env = parent.frame(), reporter = reporter) where 16 at test-goldi.R#20: test_that("testing main function", { if (os != "unix") skip("Tests are not currently performed on windows.") expect_equal(goldi(doc = doc, terms = "empty", output = output, lims = lims, log = log, object = TRUE, reader = "local", term_tdm = TDM.go.df), out) }) where 17: eval(code, test_env) where 18: eval(code, test_env) where 19: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() } }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error) where 20: doTryCatch(return(expr), name, parentenv, handler) where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]]) where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) where 23: doTryCatch(return(expr), name, parentenv, handler) where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) where 25: tryCatchList(expr, classes, parentenv, handlers) where 26: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() } }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { }) where 27: test_code(NULL, exprs, env) where 28: source_file(path, child_env(env), wrap = wrap) where 29: FUN(X[[i]], ...) where 30: lapply(test_paths, test_one_file, env = env, wrap = wrap) where 31: doTryCatch(return(expr), name, parentenv, handler) where 32: tryCatchOne(expr, names, parentenv, handlers[[1L]]) where 33: tryCatchList(expr, classes, parentenv, handlers) where 34: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL }) where 35: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, wrap = wrap)) where 36: test_files(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap, load_package = load_package) where 37: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap, load_package = load_package, parallel = parallel) where 38: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") where 39: test_check("goldi") --- value of length: 11 type: logical --- [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE --- function from context --- function (doc, terms = "You must put your terms here if not using a precomputed TDM.", lims = c(1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8), output, syn = FALSE, syn.list = NULL, object = FALSE, log = NULL, reader = "local", term_tdm = NULL, log.level = "warn") { ptm <- proc.time() pv <- packageVersion("goldi") header <- paste0("@------------------------------------------------------@\n| goldi | v", pv, " | 3/Aug/2016 |\n| ---------------------------------------------------- |\n| (C) Christopher B. Cole, MIT License |\n| ---------------------------------------------------- |\n| For documentation, citation, bug reports, and more: |\n| http://github.com/Chris1221/goldi |\n@ ---------------------------------------------------- @\n\nFor your reference, here is a list of your input options:\n\n\tterms:", capture.output(dput(terms)), "\n\tlocal:", capture.output(dput(local)), "\n\tlims:", capture.output(dput(lims)), "\n\toutput:", capture.output(dput(output)), "\n\tsyn:", capture.output(dput(syn)), "\n\tsyn.list:", capture.output(dput(syn.list)), "\n\treturn.as.list:", capture.output(dput(return.as.list)), "\n\tlog:", capture.output(dput(log)), "\n\treader:", capture.output(dput(reader)), "\n\nTo recreate this exact run at a later date, you may reinput these options.\n\nNote that any interactively created lists may be saved and inputed.\n\n") if (log.level == "info") { flog.threshold(INFO) } else if (log.level == "warn") { flog.threshold(WARN) } else if (log.level == "fatal") { flog.threshold(FATAL) } if (typeof(log) == "character") { cat(header, file = log, append = TRUE) futile.logger::appender.file(log) flog.info("Logging has been enabled. Logging to file `%s`", log) } if (lims == "interactive" || lims == "i") { lims <- make.lim() } else if (typeof(lims) == "character") { stop() flog.fatal("Improper limit input. Please see the documentation and try again.") } else if (typeof(lims) == "vector" || typeof(lims) == "double") { lims <- as.list(lims) flog.debug("Trying to coerce limits to list format.") flog.info("Printing your lims to log file. You can use this to recreate your list later:") flog.info("%s", capture.output(dput(lims))) } else if (typeof(lims) == "list") { flog.info("Using custom list.") flog.info("Printing out your list now. You can use this later") flog.info("%s", capture.output(dput(lims))) } if (reader == "R") { raw <- pdftools::pdf_text(doc) flog.info("Reading in input through pdftools::pdf_text. If you get any warnings, see their documentation.") } if (reader == "txt") raw <- readLines(doc) flog.info("Reading in input through base::readLines.") if (reader == "Py") { flog.info("Reading in input through pdfminer. This might not work; you might have to download it yourself, then read in input through txt options.") py <- system.file(package = "goldi", "pdf2txt.py") raw <- system(paste(py, doc), intern = TRUE) } if (reader == "local") raw <- doc raw <- unlist(strsplit(raw, split = ".", fixed = TRUE)) doc.vec <- VectorSource(raw) doc.corpus <- Corpus(doc.vec) sentences <- unlist(doc.vec$content) flog.info("Quality control and constructing TDM...") doc.corpus <- tm_map(doc.corpus, content_transformer(tolower)) doc.corpus <- tm_map(doc.corpus, content_transformer(replaceExpressions)) doc.corpus <- tm_map(doc.corpus, removePunctuation) doc.corpus <- tm_map(doc.corpus, removeNumbers) doc.corpus <- tm_map(doc.corpus, removeWords, stopwords("english")) doc.corpus <- tm_map(doc.corpus, stemDocument) doc.corpus <- tm_map(doc.corpus, stripWhitespace) TDM.df <- TermDocumentMatrix(doc.corpus) %>% as.matrix() %>% as.data.frame() TDM.df$words <- row.names(TDM.df) TDM.df$counts <- 0 n <- ncol(TDM.df) - 2 for (i in 1:nrow(TDM.df)) { TDM.df[i, n + 2] <- sum(TDM.df[i, 1:n]) } freq.table <- TDM.df %>% select_("words", "counts") flog.info("Constuction of PDF TDM succesful.") flog.info("Reading in term list and formatting.") flog.info("Note that we are only currently supporting text input for the term list.") if (is.null(term_tdm)) { raw_go <- readLines(paste0(terms), skipNul = T) flog.info("Reading in of term list successful") flog.info("Performing quality control for term list") raw_go <- iconv(raw_go, "WINDOWS-1252", "UTF-8") raw_go <- raw_go[which(raw_go != "")] doc.vec <- VectorSource(raw_go) doc.corpus <- Corpus(doc.vec) raw.corpus <- doc.corpus flog.info("Constructing TDM for term list") doc.corpus <- tm_map(doc.corpus, content_transformer(tolower)) doc.corpus <- tm_map(doc.corpus, content_transformer(replaceExpressions)) doc.corpus <- tm_map(doc.corpus, removePunctuation) doc.corpus <- tm_map(doc.corpus, removeNumbers) doc.corpus <- tm_map(doc.corpus, removeWords, stopwords("english")) doc.corpus <- tm_map(doc.corpus, stemDocument) doc.corpus <- tm_map(doc.corpus, stripWhitespace) TDM.go.df <- TermDocumentMatrix(doc.corpus) %>% as.matrix() %>% as.data.frame() sub <- gsub(" ", "_", x = raw_go) sub <- gsub("-", "_", x = sub) colnames(TDM.go.df) <- sub } else if (!is.null(term_tdm)) { TDM.go.df <- term_tdm } TDM.df$words <- NULL TDM.df$counts <- NULL colnames(TDM.df) <- paste0("PDF_Sentence_", 1:ncol(TDM.df)) flog.info("Term TDM construction successful") flog.info("Incorporating synonyms") if (syn) { if (is.null(syn.list)) { flog.info("Please follow the instructions to create your synonym list.") syn.list <- make.syn(T) } else if (!is.null(syn.list)) { if (typeof(syn.list) == "list") { flog.info("Using already existing synonym list.") } else { flog.fatal("You have provided a synonym list, but it is not formated as a base::list(). Please reformat it correctly, or see the documentation for examples.") stop() } } flog.info("Performing QC on synonyms") syn.corp <- VectorSource(syn.list) syn.corp <- Corpus(syn.corp) syn.corp <- tm_map(syn.corp, content_transformer(tolower)) syn.corp <- tm_map(syn.corp, content_transformer(replaceExpressions)) syn.corp <- tm_map(syn.corp, removePunctuation) syn.corp <- tm_map(syn.corp, removeNumbers) syn.corp <- tm_map(syn.corp, removeWords, stopwords("english")) syn.corp <- tm_map(syn.corp, stemDocument) syn.corp <- tm_map(syn.corp, stripWhitespace) flog.info("Matching synonyms.") for (i in 1:ncol(TDM.df)) { for (j in 1:length(syn.corp)) { for (k in 2:length(syn.corp[[j]]$content)) { if (syn.corp[[j]]$content[1] %in% row.names(TDM.df) && syn.corp[[j]]$content[k] %in% row.names(TDM.df)) { if (TDM.df[syn.corp[[j]]$content[k], i] != 0) { TDM.df[syn.corp[[j]]$content[1], i] <- 1 } } } } } out <- merge(x = TDM.go.df, y = TDM.df, by = "row.names") out[out == 1 | out == 2 | out == 3 | out == 4 | out == 5] <- 1 terms <- list() } else if (!syn) { flog.info("No synonyms selected") out <- merge(x = TDM.go.df, y = TDM.df, by = "row.names") out[out == 1 | out == 2 | out == 3 | out == 4 | out == 5] <- 1 } flog.info("Matching terms") term_vector <- which(colnames(out) %in% colnames(TDM.go.df)) pdf_index <- which(grepl("PDF_Sentence", colnames(out))) - 1 input_pdf_tdm <- suppressWarnings(out %>% as.data.frame %>% data.matrix) colnames(input_pdf_tdm) <- NULL row.names(input_pdf_tdm) <- NULL input_term_tdm <- as.matrix(TDM.go.df) input_term_tdm %<>% as.data.frame %>% data.matrix %>% suppressWarnings() colnames(input_term_tdm) <- NULL row.names(input_term_tdm) <- NULL terms <- colnames(TDM.go.df) terms <- match(term_vector = term_vector, pdf_tdm = input_pdf_tdm, term_tdm = input_term_tdm, thresholds = unlist(lims), pdf_index, terms, sentences) flog.info("Writing output to %s", output) time <- proc.time() - ptm flog.info("This run took approximately %s seconds.", round(as.double(time[3]), 3)) flog.info("Everything was successful. Ending logging now. Have a nice day.") colnames(terms) <- c("Identified Terms", "Context") if (!object) { flog.info("Returning as List, either for internal use or for testing.") writeLines(as.character(terms), output, sep = "\n") } if (object) return(terms) } --- function search by body --- Function goldi in namespace goldi has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical * checking for unstated dependencies in vignettes ... OK * checking package vignettes in ‘inst/doc’ ... OK * checking re-building of vignette outputs ... [3s/10s] OK * checking PDF version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR See ‘/data/gannet/ripley/R/packages/tests-LENGTH1/goldi.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 7:47.56, 148.20 + 22.04