Git Product home page Git Product logo

Comments (2)

ewenharrison avatar ewenharrison commented on July 29, 2024

Many thanks for your comments. Help with this is much appreciated.

I can't replicate the na_to_p issue. This is working for me as expected. Can you please provided code illustrating the issue:

> library(finalfit)
> library(magrittr)
> explanatory = c("obstruct.factor")
> dependent = "perfor.factor"
> colon_s %>%
+   summary_factorlist(dependent, explanatory, p = TRUE, p_cat = "fisher",
+                      na_to_p = FALSE, na_include = TRUE)
       label    levels         No       Yes     p
 Obstruction        No 715 (79.3) 17 (63.0) 0.026
                   Yes 166 (18.4) 10 (37.0)      
             (Missing)   21 (2.3)                
> 
> colon_s %>%
+   summary_factorlist(dependent, explanatory, p = TRUE, p_cat = "fisher",
+                      na_to_p = TRUE, na_include = TRUE)
Explanatory variable(s) missing data included in hypothesis test (p-value).
       label    levels         No       Yes     p
 Obstruction        No 715 (79.3) 17 (63.0) 0.069
                   Yes 166 (18.4) 10 (37.0)      
             (Missing)   21 (2.3)                
> 
> colon_s %$% 
+   fisher.test(perfor.factor, obstruct.factor)

	Fisher's Exact Test for Count Data

data:  perfor.factor and obstruct.factor
p-value = 0.02574
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 1.015853 5.977041
sample estimates:
odds ratio 
  2.530265 

> 
> colon_s %>%  
+   dplyr::mutate(
+     obstruct.factor = forcats::fct_explicit_na(obstruct.factor)
+   ) %$% 
+   fisher.test(perfor.factor, obstruct.factor)

	Fisher's Exact Test for Count Data

data:  perfor.factor and obstruct.factor
p-value = 0.06915
alternative hypothesis: two.sided

For the second bit, I couldn't see what missing data was being excluded. Again, would be delighted to look at code and fix anything that is not working:

> explanatory = c("obstruct.factor")
> dependent = "perfor.factor"
> colon_s %>%
+   summary_factorlist(dependent, explanatory, p = TRUE, p_cat = "fisher",
+                      na_include = TRUE, 
+                      add_dependent_label = TRUE,
+                      dependent_label_prefix = "Test")
 TestPerforation                   No       Yes     p
     Obstruction        No 715 (79.3) 17 (63.0) 0.026
                       Yes 166 (18.4) 10 (37.0)      
                 (Missing)   21 (2.3)

from finalfit.

ShuntaroS avatar ShuntaroS commented on July 29, 2024

Thank you for your quick reply.
After restarting R, the problem could not be reproduced.
I'm very sorry to have answered carefully. Next, leave a record.

from finalfit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.