This file is indexed.

/usr/share/doc/r-cran-recipes/tests/testthat/test_log.R is in r-cran-recipes 0.1.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library(testthat)
library(recipes)
library(tibble)

n <- 20
set.seed(1)
ex_dat <- data.frame(x1 = exp(rnorm(n, mean = .1)),
                     x2 = 1/abs(rnorm(n)),
                     x3 = rep(1:2, each = n/2),
                     x4 = rexp(n))

test_that('simple log trans', {
  rec <- recipe(~., data = ex_dat) %>% 
    step_log(x1, x2, x3, x4)
  
  rec_trained <- prep(rec, training = ex_dat, verbose = FALSE)
  rec_trans <- bake(rec_trained, newdata = ex_dat)
  
  exp_res <- as_tibble(lapply(ex_dat, log))
  
  expect_equal(rec_trans, exp_res)
})


test_that('alt base', {
  rec <- recipe(~., data = ex_dat) %>% 
    step_log(x1, x2, x3, x4, base = pi)
  
  rec_trained <- prep(rec, training = ex_dat, verbose = FALSE)
  rec_trans <- bake(rec_trained, newdata = ex_dat)
  
  exp_res <- as_tibble(lapply(ex_dat, log, base = pi))
  
  expect_equal(rec_trans, exp_res)
})


test_that('printing', {
  rec <- recipe(~., data = ex_dat) %>% 
    step_log(x1, x2, x3, x4)
  expect_output(print(rec))
  expect_output(prep(rec, training = ex_dat))
})