I notice that the logic of using x1 %to% x8 in R seems not consistent. Sometimes all variables physically located between the variables in the dataset are used (cfr. SPSS),
d%>%tab_cols(total()) %>%
tab_cells (mdset(Q20_01_more %to% Q20_03_more)) %>%
tab_stat_cases(total_row_position = c("none"),label = 'N') %>%
tab_stat_cpct(total_row_position = c("none"), label = '%') %>%
tab_pivot (stat_position = "inside_rows") %>%
#drop_c () %>%
recode(as.criterion(is.numeric) & is.na ~ 0, TRUE ~ copy) %>%
custom_format2() %>%
set_caption("test")
produces the tabel below containing the 3 variables stored in consecutive columns in dataframe 'd'
other times it seems that R sorts all variables based on the variable names and evaluates all variables appearing between both in the sort.
> names_totaln<-names(eval(substitute(Q20_01_more %to% Q20_03_more),d))
> names_totaln
[1] "Q20_01_more" "Q20_02" "Q20_02_less" "Q20_02_more" "Q20_03" "Q20_03_less"
[7] "Q20_03_more"
Any advice on how to use correctly?
Tx!