I am trying to reproduce this tutorial about cross tabulation using ztable package:
It should reproduce a table like this one I did using my macbook:
However, when I replicated the same code using a Windows notebook, it just shows me a bunch of html code. I tried on both console and .RMD file, none of then worked.
The same is happening with xtable package:
Does anyone knows why this is happening just with rstudio on Windows? I have both RStudio and Windows updated.
# code from M.Devlin tutorial described above [Tables and Plots of Counts and Proportions](https://rstudio-pubs-static.s3.amazonaws.com/80278_2a7b4c5561394b04ad3f135d89421919.html) library(tidyverse) library(ztable) #format tables for reporting dfr <- mtcars %>% mutate(cyl = as.factor(cyl) , gear = as.ordered(gear)) dfr_prop <- dfr %>% count(cyl, gear) %>% mutate(prop = prop.table(n)) as.data.frame(dfr_prop) dfr_perc <- dfr %>% count(cyl, gear) %>% mutate(perc = prop.table(n)*100) %>% select(-n) %>% spread(gear, perc) dfr_dist <- dfr %>% count(cyl) %>% mutate(`(\\%)` = prop.table(n)*100) %>% left_join(dfr_perc, by = 'cyl') ### 1 digit to distinguish % from n and caption ztab <- ztable(as.data.frame(dfr_dist), digits = 1 , caption = 'Distribution of Gears by Cylinders') ### name and number column groups ztab <- addcgroup(ztab, cgroup = c('Cylinders', 'Gear Distribution (\\%)') , n.cgroup = c(3, ncol(dfr_dist)-3)) ### when I try this on Windows it just shows a bunch of html code ztab