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

Do we need to check reformulate() for non-syntactic names? #104

Closed
ddsjoberg opened this issue Apr 4, 2024 · 2 comments · Fixed by #138
Closed

Do we need to check reformulate() for non-syntactic names? #104

ddsjoberg opened this issue Apr 4, 2024 · 2 comments · Fixed by #138
Assignees

Comments

@ddsjoberg
Copy link
Collaborator

I think we're using reformulate() a few times, but I just saw that it doesn't work with non-syntactic names. Do we need to write a little wrapper that adds the backticks as needed before passing it to reformulate()?

reformulate("funny name", "outcome")
#> Error in str2lang(termtext): <text>:1:7: unexpected symbol
#> 1: funny name
#>           ^
reformulate("`funny name`", "outcome")
#> outcome ~ `funny name`

Created on 2024-04-03 with reprex v2.1.0

@ddsjoberg
Copy link
Collaborator Author

Maybe just have a little helper function that adds backticks? We could just wrap the inputs to reformulate()?

bt <- function(x) paste0("`", x, "`")

@ddsjoberg
Copy link
Collaborator Author

The answer is yes, we need to update: See #121

@zdz2101 zdz2101 self-assigned this Apr 24, 2024
@zdz2101 zdz2101 linked a pull request Apr 26, 2024 that will close this issue
13 tasks
ddsjoberg pushed a commit that referenced this issue Apr 27, 2024
**What changes are proposed in this pull request?**
Address use of `reformulate()` for nonsyntactic names by adopting
`reformulate2()` from model construction helpers

**Reference GitHub issue associated with pull request.** 

Closes #104


--------------------------------------------------------------------------------

Pre-review Checklist (if item does not apply, mark is as complete)
- [ ] **All** GitHub Action workflows pass with a ✅
- [ ] PR branch has pulled the most recent updates from master branch:
`usethis::pr_merge_main()`
- [ ] If a bug was fixed, a unit test was added.
- [ ] If a new `ard_*()` function was added, it passes the ARD
structural checks from `cards::check_ard_structure()`.
- [ ] If a new `ard_*()` function was added, `set_cli_abort_call()` has
been set.
- [ ] If a new `ard_*()` function was added and it depends on another
package (such as, `broom`), `is_pkg_installed("broom", reference_pkg =
"cardx")` has been set in the function call and the following added to
the roxygen comments: `@examplesIf
do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"",
reference_pkg = "cardx"))`
- [ ] Code coverage is suitable for any new functions/features
(generally, 100% coverage for new code): `devtools::test_coverage()`

Reviewer Checklist (if item does not apply, mark is as complete)

- [ ] If a bug was fixed, a unit test was added.
- [ ] Code coverage is suitable for any new functions/features:
`devtools::test_coverage()`

When the branch is ready to be merged:
- [ ] Update `NEWS.md` with the changes from this pull request under the
heading "`# cardx (development version)`". If there is an issue
associated with the pull request, reference it in parentheses at the end
update (see `NEWS.md` for examples).
- [ ] **All** GitHub Action workflows pass with a ✅
- [ ] Approve Pull Request
- [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants