Add a by attribute to data_tabulate() objects when by is present#690
Add a by attribute to data_tabulate() objects when by is present#690elinw wants to merge 8 commits into
by attribute to data_tabulate() objects when by is present#690Conversation
etiennebacher
left a comment
There was a problem hiding this comment.
Thanks! Yes please add at least one test for this.
| class(out) <- c("datawizard_tables", "list") | ||
| } else { | ||
| class(out) <- c("datawizard_crosstabs", "list") | ||
| attr(out, "by") <- gsub('\\"', "", by_name, fixed = TRUE) |
There was a problem hiding this comment.
Why is the gsub() necessary?
There was a problem hiding this comment.
Because in this case (but not the other) the name returns e.g. "/"Island"/". I'm not sure why or if there is a way to get the name without the escapes. I tried some ideas but there was nothing obvious to me.
There was a problem hiding this comment.
Meaning when a quoted variable name is used for by.
There was a problem hiding this comment.
Ok, should this also remove ' if one passes 'Island' in by?
There was a problem hiding this comment.
I also don't think \\ is necessary if fixed = TRUE is used
There was a problem hiding this comment.
And actually I stupidly followed the advice from the tester and added fixed = TRUE but that was wrong, this is not fixed it just looks like fixed. So the next push will put that back.
| class(out) <- c("datawizard_tables", "list") | ||
| } else { | ||
| class(out) <- c("datawizard_crosstabs", "list") | ||
| attr(out, "by") <- gsub('\\"', "", by_name, fixed = TRUE) |
| * `data_tabluate()` now returns an attribute "by" with the | ||
| `by` variable name when the `by` parameter is used. |
There was a problem hiding this comment.
| * `data_tabluate()` now returns an attribute "by" with the | |
| `by` variable name when the `by` parameter is used. | |
| * `data_tabulate()` now returns an attribute "by" with the | |
| `by` variable name when the `by` parameter is used. |
Also please add the PR number and your username.
by attribute to 1data_tabulate() objects when by` is present
by attribute to 1data_tabulate() objects when by` is presentby attribute to data_tabulate() objects when by is present
I wasn't sure if you would want an additional test; all the current tests are still passing.
The attributes aren't listing in the documentation so I didn't change anything there.
Closes #688