-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: master
Are you sure you want to change the base?
Conversation
vignettes/combine-cut-interact.Rmd
Outdated
|
||
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
vignettes/combine-cut-interact.Rmd
Outdated
|
||
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 |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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). | ||
|
There was a problem hiding this comment.
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 Report
@@ Coverage Diff @@
## master #195 +/- ##
=======================================
Coverage 89.81% 89.81%
=======================================
Files 104 104
Lines 6355 6355
=======================================
Hits 5708 5708
Misses 647 647
Continue to review full report at Codecov.
|
…ch into GitBrianLaw-combine_vignette
…is loaded, and a user uses ?cut they are provided with a choice of pages to visit so we aren't clobbering the base-version, and we get free pkgdown linking this way (as well as an easier way to get to crunch::cut's documentation))
…ttes that are already created.
…crunch into combine_vignette
There was a problem hiding this 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.
vignette-data/make-vignette-rdata.R
Outdated
# options(crunch.api=getOption("test.api"), | ||
# crunch.debug=FALSE, | ||
# crunch.email=getOption("test.user"), | ||
# crunch.pw=getOption("test.pw")) |
There was a problem hiding this comment.
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.
vignettes/combine-cut-interact.Rmd
Outdated
|
||
- `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 |
There was a problem hiding this comment.
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.
vignettes/combine-cut-interact.Rmd
Outdated
``` | ||
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. |
There was a problem hiding this comment.
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?
Brian first draft of vignette on combine cut and interAction functions