Error in `predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), newdata, na.action = na.action)) else as.matrix(newdata), object$s, object$weights, object$robust, op$span, op$degree, op$normalize, op$parametric, op$drop.square, op$surface, op$cell, op$family, object$kd, object$divisor, se = se)`: NA/NaN/Inf in foreign function call (arg 5)

txt <- c("a b c d 0.2 . (xxx) \u2700", "a b_c 1st 2nd k100@gmail.com",
"Aa bb cc. Xx yy zz.", "Aa bb cc. Xx yy zz.")
dat <- data.frame(doc_id = paste0("text", 1:4),
expect_equal(as.seedwords(lis2, upper = 2, lower = 1),
expect_equal(as.seedwords(lis3, upper = "pos", lower = "neg"),
expect_equal(as.seedwords(lis4, upper = "pos", lower = "neg"),
expect_equal(as.seedwords(lis5, upper = c("pos1", "pos2"), lower = "neg"),
expect_equal(as.seedwords(dict1, upper = "pos", lower = "neg"),
expect_error(as.seedwords(data.frame(1:3)), "x must be a list or dictionary object")
dict2 <- dictionary(list("pos" = "very good", "neg" = "very bad"))
dfmt <- dfm(toks, remove_padding = TRUE) %>%
dfm_subset(Party %in% c("Democratic", "Republican")) %>%
lss <- textmodel_lss(dfmt, seed, k = 150, include_data = TRUE,
smo_le <- smooth_lss(dat, lss_var = "lss", by = "year",
smo_lf <- smooth_lss(dat, lss_var = "lss", by = "year",
expect_true(cor(smo_le$fit, smo_lf$fit, use = "pair") > 0.90)
smo_gr_le <- smooth_lss(dat, lss_var = "lss", by = "year",
span = 0.1, groups = "Party", engine = "loess")
c("date", "time", "fit", "se.fit", "Party"))
smo_gr_lf <- smooth_lss(dat, lss_var = "lss", by = "year",
span = 0.1, groups = "Party", engine = "locfit")
expect_true(cor(smo_gr_le$fit, smo_gr_lf$fit, use = "pair") > 0.90)
smooth_lss(dat, lss_var = "lss", date_var = "xxx"),
smooth_lss(dat, lss_var = "lss", date_var = "Year"),
smooth_lss(dat, lss_var = "lss", groups = "xxx"),
test_that("smooth_lss works with multiple grouping variables", {
class1 = factor(sample(c("a", "b", "c"), n, replace = TRUE),
class2 = sample(c("A", "B"), n, replace = TRUE),
smo2 <- smooth_lss(dat, groups = "class1")
smo3 <- smooth_lss(dat, groups = c("class1", "class2"))
c(date = "Date", time = "numeric", fit = "numeric", se.fit = "numeric")
c(date = "Date", time = "numeric", fit = "numeric", se.fit = "numeric",
class1 = "factor", class2 = "character")
smooth_lss(dat, groups = c("class1", "xxxx")),
smooth_lss(dat, groups = c("class1", "number")),
"columns for grouping cannot be numeric"

"smooth_lss works with multiple grouping variables"

smooth_lss works with multiple grouping variables