creating function for expss tables

I am trying to create a function which can show tables like SPSS from EXPSS package.
i have database with variables having multiple factors and i want to show the percentage of responses for the variables but unable to create table.

df <- mtcars

df$all<- 1
df$large<-ifelse(df$am ==1,1,NA)


banner <- list(df$all,df$small,df$large)

df$vs<-factor(df$vs, levels=c(0,1), labels = c("Available","Not AVailable"))
df$am<-factor(df$am, levels=c(0,1), labels = c("Available","Not AVailable"))

fun1 <- function(data,var_list,banner1){
  df1<-data[var_list] %>% 
  t2 <-  df1 %>% 
      cell_vars = var_list,
      col_vars = banner1

fun1(data = df,var_list = c("vs","am"),banner1 = banner)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.