UBC-MDS / speed_dating_analysis

This repo is for a group project for analyzing speed dating data set for MDS-522
Other
0 stars 0 forks source link

Test output improvement #32

Open rorywhite200 opened 10 months ago

rorywhite200 commented 10 months ago

I was wondering if there is anything we can do to improve the print out from our Pearson's test and t-test. Wrapping them in a function prevents them from displaying the actual column names and instead shows the data: data %>% pull({ { col1 } }) and data %>% pull({ { col2 } }) (see example below). This may be an inevitable part of needlessly wrapping the tests in functions. What do you think?

Pearson's product-moment correlation

data: data %>% pull({ { col1 } }) and data %>% pull({ { col2 } }) t = 5.0431, df = 312, p-value = 3.892e-07 alternative hypothesis: true correlation is greater than 0 95 percent confidence interval: 0.1862952 1.0000000 sample estimates: cor 0.2745402

monazhu commented 10 months ago

We can actually clean up the output and format it into a tibble with broom's tidy() function (see: https://cran.r-project.org/web/packages/broom/vignettes/broom.html)

There are also other formatting packages out there (I've used the flextable package before but there are many more: https://rfortherestofus.com/2019/11/how-to-make-beautiful-tables-in-r)

rorywhite200 commented 10 months ago

Thanks Mona! I will create a branch to edit the analysis file and add tidy formatting to our tests

monazhu commented 10 months ago

Thanks for implementing that Rory! Typically for APA format, 3 decimal places is more than sufficient for reporting purposes (although we're losing precision, I think at some point having more decimal places does make the result less readable). That being said, there should be options to change the output so we can get more decimal places if needed (see: https://stackoverflow.com/a/60004882)

wenyunie commented 10 months ago

Wonderful suggestion! I will also try to make this change on the t test part.

wenyunie commented 10 months ago

It seems it has already been done~ Thanks @rorywhite200