Questions tagged [expss]

expss package provides tabulation functions with support for 'SPSS'-style labels, multiple / nested banners, weights, multiple-response variables and significance testing.

expss package provides tabulation functions with support for 'SPSS'-style labels, multiple / nested banners, weights, multiple-response variables and significance testing.

147 questions
3
votes
1 answer

count_if (EXPSS) with multiple conditions in R

I am using expss::count_if. While something like this works fine (i.e., counting values only where value is equal to "1"): (number_unemployed = count_if("1",unemployed_field,na.rm = TRUE)), This does not (i.e., counting values only where value is…
DiamondJoe12
  • 1,879
  • 7
  • 33
  • 81
3
votes
1 answer

How to create weighted, labelled summary tables for both html and pdf?

I'd like to create large crosstables with summary statistics of multiple row variables by multiple column variables - and found two packages that make it very easy to beautiful large tables: the tables package by Duncan Murdoch and the expss package…
gplngr
  • 77
  • 7
3
votes
1 answer

Formatting tables in R Markdown to export to MS Word document

I've started using expss in R Markdown for generating tables with the help of Knitr. I would like to automate the tables and analysis for a report I need to prepare in Microsoft Word format. When knitting to HTML, the tables look wonderful. The…
André van Zyl
  • 153
  • 1
  • 8
3
votes
1 answer

How to prevent R Expss from mixing variable name with row label in output data frame?

When running table using Expss package, the variable label gets mixed with each row in the dataframe (tables are output as dataframes). See code below. You will notice that each row label gets prepended with the variable label "Gender" and a bar |…
CK7
  • 229
  • 1
  • 11
3
votes
1 answer

Adjusting Column Widths with expss Package

I've been using expss frequently and find it very useful, however, in some cases I have column values that are long strings which do not fit into the default column widths. For example, the image below shows a column that needs widening. What…
Ben
  • 1,113
  • 10
  • 26
3
votes
0 answers

Reorder columns of expss table

I wanting to arrange the tab_cols from the expss package. for example i want to order cols d,b,c from my test data set (below). Its seems cols are tabbed alphabetically.. test<-data.frame(group=c(rep("b",3),rep("c",3),rep("d",3)),num=1:9) test …
e.matt
  • 836
  • 1
  • 5
  • 12
3
votes
1 answer

Count UNIQUE points within each grid box

I have the following data: EDIT: With smaller sample data dat <- structure(list(SN = c(198305L, 198305L, 198305L, 198305L, 198305L,198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L, 198305L,…
Lyndz
  • 347
  • 1
  • 13
  • 30
3
votes
0 answers

Removing HTML tag from DT datatable output

Trying to make a table in shiny using expss package however while downloading data, HTML tags are also coming in the column headers which should not be. can anyone please help…
nikki
  • 239
  • 1
  • 12
2
votes
1 answer

Add the same value labels to multiple dataframe columns using expss::val_lab

I'm trying to add the same value labels to multiple columns in a dataframe using the expss::val_lab function, but any labelling function in expss well work for me. #Example data ex1 <- c(1,1,2,2,3,3,4,4,5,5) ex2 <- c(5,4,3,2,1,1,2,3,4,5) ex6 <-…
Mike
  • 23
  • 4
2
votes
0 answers

total() in tab_cols only sum up to one, any suggestion?

Suppose I have dataframe 'y' WR<-c("S",'J',"T") B<-c("b1","b2","b3") wgt<-c(0.3,2,3) y<-data.frame(WR,B,wgt) I want to make column percentage crosstab with B as row, WR, and total of WR as columns using expss function library(expss) y %>%…
Szicocs
  • 21
  • 2
2
votes
1 answer

Labels applied in R do not save when writing as a Stata file

I added variable (and value, for some) labels in R, using the apply_labels function from 'expss'. When I want to save the data using 'write.dta' and open it in Stata (or reopening the newly saved data in R), the labels do not appear. I am suspecting…
Joost Maxen
  • 167
  • 8
2
votes
1 answer

tab_stat_cpct producing wrong column percentage totals

I have been running tables including tab_stat_cpct hoping to have col %'s appearing in the bottom row adding up to 100% in each column. But this is what I get... mtcars %>% tab_cells(am) %>% tab_cols(total(),vs) %>% tab_stat_cases(label = "N")…
Derek Pace
  • 23
  • 3
2
votes
1 answer

expss mdset table with both counts and percentages

For a multiple response (multiple dichotomy) set, I would like to make a simple table showing both counts and percents of valid responses. checkall <- data.frame(ID=1:60, q1a=sample(c(0,1), size=60, replace=TRUE), …
emudrak
  • 789
  • 8
  • 25
2
votes
1 answer

r expss recoding factor

I'd like to make small recoding on factor variable using examples from: https://cran.r-project.org/web/packages/expss/vignettes/tables-with-labels.html a<-c(1,2,1,3,5,4,1,3,2,2,1,1) a<-factor(a,levels = c(1,2,3,4,5), labels = c("aa", "bb", "cc",…
piokol
  • 121
  • 7
2
votes
1 answer

Use pipe operator into `expss::uselabels()`?

I am trying to pipe into expss::uselabels(). A simple replicable example of what I'm trying to do (without the pipe), would be a labelled lm() model: library(tidyverse) library(expss) df <- mtcars df <- apply_labels(df, cyl = …
Jeremy K.
  • 1,710
  • 14
  • 35
1
2
3
9 10