Skip to content

Commit

Permalink
fix r cmd check by making examples dont run
Browse files Browse the repository at this point in the history
  • Loading branch information
max-pilz committed Apr 15, 2024
1 parent f04a323 commit efc903e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
10 changes: 6 additions & 4 deletions R/MetaNLP.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ setClass("MetaNLP", representation(data_frame = "data.frame"))
#' An object of class \code{MetaNLP} contains a slot data_frame where
#' the word count data frame is stored.
#' The CSV file must have a column \code{ID} to identify each paper, a column
#' \code{Title} with the belonging titles of the papers and a column
#' \code{Abstract} which contains the abstracts. Furthermore, to store the
#' decision for each paper, a column \code{Decision} should exist, where the
#' \code{title} with the belonging titles of the papers and a column
#' \code{abstract} which contains the abstracts. Furthermore, to store the
#' decision for each paper, a column \code{decision} should exist, where the
#' values are either "yes" and "no" or "include" and "exclude". The value "maybe"
#' is handled as a "yes"/"include".
#'
#' @rdname MetaNLP
#' @export
MetaNLP <- function(path, bounds = c(2, Inf), word_length = c(3, Inf)) {
title <- NULL
abstract <- NULL

# load file
file <- utils::read.csv(path, header = TRUE, sep = ";")
Expand All @@ -62,7 +64,7 @@ MetaNLP <- function(path, bounds = c(2, Inf), word_length = c(3, Inf)) {
within(x <- paste(title, abstract)) |>
(`[[`)(c("x")) |>
# lower case
tolower()|>
tolower() |>
# lemmatization of the words
textstem::lemmatize_strings() |>
tm::VectorSource() |>
Expand Down
8 changes: 6 additions & 2 deletions R/delete_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ setGeneric("delete_words", function(object, delete_list) {


#' @examples
#' obj<- MetaNLP("tests/testthat/data/test_data.csv")
#' \dontrun{
#' obj<- MetaNLP("test_data.csv")
#' del_words <- c("beautiful", "considering", "found")
#' obj <- delete_words(obj, del_words)
#' }
#'
#' @rdname delete_words
#' @export
Expand Down Expand Up @@ -71,8 +73,10 @@ setGeneric("delete_stop_words", function(object, ...) {
})

#' @examples
#' obj <- MetaNLP("tests/testthat/data/test_data.csv")
#' \dontrun{
#' obj <- MetaNLP("test_data.csv")
#' obj <- delete_stop_words(obj, "english")
#' }
#'
#' @rdname delete_stop_words
#' @export
Expand Down
6 changes: 3 additions & 3 deletions man/MetaNLP.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/delete_stop_words.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/delete_words.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test_deletion.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ test_that("Deletion functions work", {

# The first four words of the vector exist in (possibly modified) form in the
# word count matrix of the test data
obj <- MetaNLP("data/test_data.csv")
source_path <- test_path("data", "test_data.csv")
obj <- MetaNLP(source_path)
deletion_list <- c("beautiful", "considering", "facts", "find", "algebra")
obj_delete <- delete_words(obj, deletion_list)
obj_stop_words <- delete_stop_words(obj)
Expand Down

0 comments on commit efc903e

Please sign in to comment.