Running examples in ‘sjmisc-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: add_columns
> ### Title: Add or replace data frame columns
> ### Aliases: add_columns replace_columns add_id
> 
> ### ** Examples
> 
> data(efc)
> d1 <- efc[, 1:3]
> d2 <- efc[, 4:6]
> 
> library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> head(bind_cols(d1, d2))
  c12hour e15relat e16sex e17age e42dep c82cop1
1      16        2      2     83      3       3
2     148        2      2     88      3       3
3      70        1      2     82      3       2
4     168        1      2     67      4       4
5     168        2      2     84      4       3
6      16        2      2     85      4       2
> add_columns(d1, d2) %>% head()
  e17age e42dep c82cop1 c12hour e15relat e16sex
1     83      3       3      16        2      2
2     88      3       3     148        2      2
3     82      3       2      70        1      2
4     67      4       4     168        1      2
5     84      4       3     168        2      2
6     85      4       2      16        2      2
> 
> d1 <- efc[, 1:3]
> d2 <- efc[, 2:6]
> 
> add_columns(d1, d2, replace = TRUE) %>% head()
  c12hour e15relat e17age e42dep c82cop1 e16sex
1      16        2     83      3       3      2
2     148        2     88      3       3      2
3      70        1     82      3       2      2
4     168        1     67      4       4      2
5     168        2     84      4       3      2
6      16        2     85      4       2      2
> add_columns(d1, d2, replace = FALSE) %>% head()
New names:
• `e15relat` -> `e15relat...1`
• `e16sex` -> `e16sex...2`
• `e15relat` -> `e15relat...7`
• `e16sex` -> `e16sex...8`
  e15relat...1 e16sex...2 e17age e42dep c82cop1 c12hour e15relat...7 e16sex...8
1            2          2     83      3       3      16            2          2
2            2          2     88      3       3     148            2          2
3            1          2     82      3       2      70            1          2
4            1          2     67      4       4     168            1          2
5            2          2     84      4       3     168            2          2
6            2          2     85      4       2      16            2          2
> 
> # use case: we take the original data frame, select specific
> # variables and do some transformations or recodings
> # (standardization in this example) and add the new, transformed
> # variables *to the end* of the original data frame
> efc %>%
+   select(e17age, c160age) %>%
+   std() %>%
+   add_columns(efc) %>%
+   head()
  c12hour e15relat e16sex e17age e42dep c82cop1 c83cop2 c84cop3 c85cop4 c86cop5
1      16        2      2     83      3       3       2       2       2       1
2     148        2      2     88      3       3       3       3       3       4
3      70        1      2     82      3       2       2       1       4       1
4     168        1      2     67      4       4       1       3       1       1
5     168        2      2     84      4       3       2       1       2       2
6      16        2      2     85      4       2       2       3       3       3
  c87cop6 c88cop7 c89cop8 c90cop9 c160age c161sex c172code c175empl barthtot
1       1       2       3       3      56       2        2        1       75
2       1       3       2       2      54       2        2        1       75
3       1       1       4       3      80       1        1        0       35
4       1       1       2       4      69       1        2        0        0
5       2       1       4       4      47       2        2        0       25
6       2       2       1       1      56       1        2        1       60
  neg_c_7 pos_v_4 quol_5 resttotn tot_sc_e n4pstu nur_pst   e17age_z
1      12      12     14        0        4      0      NA  0.4791992
2      20      11     10        4        0      0      NA  1.0969170
3      11      13      7        0        1      2       2  0.3556557
4      10      15     12        2        0      3       3 -1.4974976
5      12      15     19        2        1      2       2  0.6027428
6      19       9      8        1        3      2       2  0.7262864
    c160age_z
1  0.19002509
2  0.04023278
3  1.98753275
4  1.16367507
5 -0.48404028
6  0.19002509
> 
> # new variables with same name will overwrite old variables
> # in "efc". order of columns is not changed.
> efc %>%
+   select(e16sex, e42dep) %>%
+   to_factor() %>%
+   add_columns(efc) %>%
+   head()
Error in set_labels_helper(x = .dat, labels = labels, force.labels = force.labels,  : 
  Package 'haven' required for this function. Please install it.
Calls: %>% ... withCallingHandlers -> set_labels -> set_labels_helper
Execution halted