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 

I used this code to give me a boxplot:

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

But i need it in APA style, i found this 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
+ )

However the error "Error in theme_apa() : could not find function "theme_apa"" came up. How can i fix this? or is there another way to integrate APA style

camille
  • 16,432
  • 18
  • 38
  • 60
Iesha Tucker
  • 3
  • 1
  • 3
  • 1
    An [internet search](https://rdrr.io/cran/jtools/man/theme_apa.html) found that `theme_apa` is found in package **jtools**. – tpetzoldt May 19 '21 at 16:27

1 Answers1

0

Using google search engine, I found that theme_apa function is from an R package called jtools. Have you had this package installed? If so, before using the theme_apa function, you need to make sure that it currently loaded in your R session. For example:

library(jtools)

If you have not yet installed the package, you can run:

install.packages("jtools") # this should be run just once
library(jtools)
bird
  • 2,938
  • 1
  • 6
  • 27