0

this is the code and data i already have:

library(tidyverse)
t.test(BMIS ~ CONDITION, var.equal =TRUE, data = BMIS_DATA)
descriptive_statistics = BMIS_DATA %>% 
                           group_by(CONDITION) %>% 
                           summarise(
                             mean = mean (BMIS), 
                             sd = sd (BMIS),  
                             n = n ()
                         )
view(descriptive_statistics)
mean_difference = descriptive_statistics [1,2] - descriptive_statistics [2,2]

which gave me :

Two Sample t-test

data:  BMIS by CONDITION
t = 3.7455, df = 44, p-value = 0.0005201
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  4.299781 14.317362
sample estimates:
mean in group HAPPY   mean in group SAD 
           45.88000            36.57143 

How do I create some visual data from this?

Phil
  • 7,287
  • 3
  • 36
  • 66
Iesha Tucker
  • 3
  • 1
  • 3
  • library(ggplot2) ggplot(BMIS_DATA,aes(x=CONDITION,y=BMIS,col=CONDITION))+geom_boxplot() i added this to create a graph but i now need to make it APA style, i found a code online: theme_apa( + legend.pos = "right", + legend.use.title = FALSE, + legend.font.size = 12, + x.font.size = 12, + y.font.size = 12, + facet.title.size = 12, + remove.y.gridlines = TRUE, + remove.x.gridlines = TRUE + ) but it kept on coming up with error apa theme not found , does anyone know how i fix this ? – Iesha Tucker May 19 '21 at 15:04

1 Answers1

0

If I understood your question correctly, you can easily represent the distributions according to your CONDITION variable. The following code allows you to visualize this from boxplots:

library(ggplot2)
ggplot(BMIS_DATA,aes(x=CONDITION,y=BMIS,col=CONDITION))+geom_boxplot()

Then, the classical functions of the ggplot2 package can be applied. To customize : ?geom_boxplot.

gdrouard
  • 126
  • 6
  • library(ggplot2) ggplot(BMIS_DATA,aes(x=CONDITION,y=BMIS,col=CONDITION))+geom_boxplot() i added this to create a graph but i now need to make it APA style, i found a code online: theme_apa( + legend.pos = "right", + legend.use.title = FALSE, + legend.font.size = 12, + x.font.size = 12, + y.font.size = 12, + facet.title.size = 12, + remove.y.gridlines = TRUE, + remove.x.gridlines = TRUE + ) but it kept on coming up with error apa theme not found , does anyone know how i fix this ? – Iesha Tucker May 19 '21 at 15:09
  • The apa theme comes from the **jtools** package. Install the jtools package then load it. – gdrouard May 19 '21 at 15:36