Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vignette on combine cut interaction functions #195

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

GitBrianLaw
Copy link
Contributor

Brian first draft of vignette on combine cut and interAction functions


And now we have a new Categorical type variable with the alias `age4`, the name "Age (4 categories)", and it's made of 4 categories.

# Re-Combining Answer Choices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I read re-combining at first, I found it a bit awkward. I wonder if maybe just "Combining answer choices" would be better here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Re-combining is not great. Let's switch


We have created a new Multiple Response type variable with the alias `boap_combined`, the name "Approval of Obama on issues (Combined Subvariables)", which has 4 subvariables instead of the original 13.

# Re-Combining Variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think this might be ok just called "Combining variables"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup


# Re-Combining Variables
Besides re-combining answer choices, we can also re-combine variables. For example, if our dataset has a categorical type variable for gender and another categorical type variable for Age, then we can cross these two together into a new variable using the `interactVariables()` function (named after the use of 'interaction terms' in regression).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to add a more elaborated use case in here.

@codecov
Copy link

codecov bot commented Jan 26, 2018

Codecov Report

Merging #195 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #195   +/-   ##
=======================================
  Coverage   89.81%   89.81%           
=======================================
  Files         104      104           
  Lines        6355     6355           
=======================================
  Hits         5708     5708           
  Misses        647      647
Impacted Files Coverage Δ
R/cut.R 95.71% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8e74b1...bc79493. Read the comment docs.

Copy link
Contributor

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed most of these questions myself. I also reworked the cooking-show in make-vignette-rdata so as not to have the new variables we create for this vignette show up in the previous vignettes.

# options(crunch.api=getOption("test.api"),
# crunch.debug=FALSE,
# crunch.email=getOption("test.user"),
# crunch.pw=getOption("test.pw"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have mentioned this before, brian, we should set up your r profile to have values for these options that point to a good backend. In the repository these lines should stay uncommented.


- `cut()` allows you to transform a continuous numeric variable into a set of bins
- `combine()` lets you collapse a categorical variable's categories together
- `subtotals()` displays subtotaled categories along side the other categories
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't go into too much detail about this lower down, so I would vote that we remove it from our list here.

```
And now we have a new variable with the alias `age3`, the name "Age (3 categories)", and a category that combines 18 to 44 year-olds.

Note how this created an entirely new variable and so we can use it just like any other variable in Crunch. We can hide the original "Age (4 categories)" variable because we no longer need it. Hiding the original variable will not affect our new variable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to link to the vignette that explains hide? or the help file? Or provide an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants