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

Error from name collisions in shapiro_test() #52

Closed
ClaudiuPapasteri opened this issue Jun 7, 2020 · 3 comments
Closed

Error from name collisions in shapiro_test() #52

ClaudiuPapasteri opened this issue Jun 7, 2020 · 3 comments

Comments

@ClaudiuPapasteri
Copy link

ClaudiuPapasteri commented Jun 7, 2020

Hello,

Thank you for your wonderful packages. They are really appreciated.
I found that shapiro_test() throws an error if it is provided with column names "value" or "variable" as input.

Reproducible example:

data("selfesteem2", package = "datarium")

selfesteem2 <- selfesteem2 %>%
  gather(key = "time", value = "value", t1, t2, t3) %>%
  convert_as_factor(id, time)

selfesteem2 %>%
  group_by(treatment, time) %>%
  shapiro_test(value) 

Error: Column variable is unknown

data("selfesteem2", package = "datarium")

selfesteem2 <- selfesteem2 %>%
  gather(key = "time", value = "variable", t1, t2, t3) %>%
  convert_as_factor(id, time)

selfesteem2 %>%
  group_by(treatment, time) %>%
  shapiro_test(variable) 

Error: Result must have length 12, not 0

@Si-Thu-Thein
Copy link

Can confirm. It's a weird bug.

@kassambara
Copy link
Owner

fixe now, thanks

@kulbhushanchand
Copy link

Hi @kassambara, looks like the bug is still there. Can you kindly check this following example.
Example -

library(rstatix)

data <- data.frame(
  sub = c(1,2,3,4,5,6,7,8,9,10,11,12),
  baseline = c(25,27,23,25,24,20,19,24,15,20,23,21),
  intervention = c(10,7,12,11,15,18,11,10,13,8,9,8)
  )
  
my_data <- data %>%
  gather(key = "variable", value = "value",-sub)


my_data %>%
  group_by(variable) %>%
  shapiro_test(value)

Error -

Error: Problem with `mutate()` input `data`.
x Must group by variables found in `.data`.
* Column `variable` is not found.
i Input `data` is `map(.data$data, .f, ...)`.

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

No branches or pull requests

4 participants