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

Reproducible error #431

Closed
cknuckles opened this issue Nov 11, 2021 · 2 comments · Fixed by #434
Closed

Reproducible error #431

cknuckles opened this issue Nov 11, 2021 · 2 comments · Fixed by #434

Comments

@cknuckles
Copy link

< -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

The problem

I created the example below for my stats programming college course as a quick , easily comprehensible way to introduce permutation resampling. The error message is very curious. I could find no help by searching stackoverflow, etc. For what it's worth I am a very experienced programmer. I was finally able to fix the problem simply by changing the variable name x to something else. Passing in x in this way causes the error, and any other name instead of x seems to work. My best guess from looking at the error message is that when an x is passed into your functions as below, it somehow gets scope that allows it to interfere with a variable named x that your code uses internally.

Reproducible example

library(tidyverse)
library(infer)

test_table <- tibble(
category = c('A','A','A','A','A','B','B','B','B','B'),
x = 1:10
)

test_table %>%
specify(explanatory = category, response = x) %>%
hypothesize(null = "independence") %>%
generate(reps = 5, type = "permute")

## copy your code to the clipboard and run:
reprex::reprex(si = TRUE)
@simonpcouch
Copy link
Collaborator

Thanks for the issue! Addressed in #434, closing this in favor of that PR.

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants