Skip to content

Commit

Permalink
Merge pull request #141 from Crunch-io/issue_104
Browse files Browse the repository at this point in the history
Updating FAQ with sorting examples
  • Loading branch information
1beb authored May 13, 2020
2 parents 59de7f4 + fb5ae27 commit 367c2cc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions vignettes/FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,31 @@ myTheme <- themeNew(
writeExcel(ct_summary, filename = "output", theme = myTheme)
```

### How do I sort a categorical or multiple response question's presenation?

You can sort response categories alphabetically or by proportion. You can apply a fixed presentation order and you can pin response categories to the top or bottom.

```{r, eval = FALSE}
ds = loadDataset("Example dataset")
# Use ds = newExampleDataset() if it doesn't work
ct = crosstabs(ds)
ct = sortAliases(ct)
writeLatex(ct, ...)
```

The default behaviour sorts all questions that can be sorted, descending by order of proportion. But we can apply a variety of different sorting options by using the `sortAliases` function repeatedly.

```{r, eval = FALSE}
# load ds, define theme ...
ct = sortAliases(ct, var = c("a", "b"), alpha = TRUE) # sort a/b by alpha
ct = sortAliases(ct, var = "c") # sort c by numeric
ct = sortAliases(ct, var = "d", pin_to_bottom = "Don't know")
writeLatex(ct, ...)
```

### How do I request a new feature?

We welcome features requests as new issues to the [crunchtabs github repository](https://github.com/Crunch-io/crunchtabs/issues)

0 comments on commit 367c2cc

Please sign in to comment.