├── .Rbuildignore
├── .github
├── .gitignore
└── workflows
│ └── pkgdown.yaml
├── .gitignore
├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── NEWS.md
├── R
├── apaANOVATable1way.R
├── apaANOVATable2way.R
├── apaAOVTable.R
├── apaCorrelationTable.R
├── apaDvalueTable.R
├── apaEZANOVA.R
├── apaRegressionTable.R
├── apaTables.R
├── data-album.R
├── data-dating_wide.R
├── data-drink_attitude_wide.R
├── data-eysenck.R
├── data-fidler_thompson.R
├── data-goggles.R
├── data-viagra.R
├── deltaR2.R
├── etaSquaredCI.R
├── papajaOutput.R
├── pdfOutput.R
├── rtfMakeDocument.R
├── rtfMakeTable.R
├── rtfOutput.R
└── tests_for_apaTables.R
├── README.md
├── _pkgdown.yml
├── apaTables.Rproj
├── data
├── Eysenck.rda
├── album.rda
├── dating_wide.rda
├── drink_attitude_wide.rda
├── fidler_thompson.rda
├── goggles.rda
└── viagra.rda
├── docs
├── 404.html
├── LICENSE-text.html
├── articles
│ ├── Table1.jpg
│ ├── Table10.jpg
│ ├── Table11.jpg
│ ├── Table2.jpg
│ ├── Table3.jpg
│ ├── Table4.jpg
│ ├── Table5.jpg
│ ├── Table6.jpg
│ ├── Table7.jpg
│ ├── Table8.jpg
│ ├── Table9.jpg
│ ├── apaTables.html
│ ├── articles
│ │ └── apaTables.html
│ └── index.html
├── authors.html
├── deps
│ ├── bootstrap-5.2.2
│ │ ├── bootstrap.bundle.min.js
│ │ ├── bootstrap.bundle.min.js.map
│ │ └── bootstrap.min.css
│ ├── data-deps.txt
│ └── jquery-3.6.0
│ │ ├── jquery-3.6.0.js
│ │ ├── jquery-3.6.0.min.js
│ │ └── jquery-3.6.0.min.map
├── index.html
├── link.svg
├── news
│ └── index.html
├── pkgdown.js
├── pkgdown.yml
├── reference
│ ├── Eysenck.html
│ ├── Rplot001.png
│ ├── album.html
│ ├── apa.1way.table.html
│ ├── apa.2way.table.html
│ ├── apa.aov.table.html
│ ├── apa.cor.table.html
│ ├── apa.d.table.html
│ ├── apa.ezANOVA.table.html
│ ├── apa.knit.table.for.pdf.html
│ ├── apa.reg.table.html
│ ├── apa.save.html
│ ├── apaTables.html
│ ├── dating_wide.html
│ ├── drink_attitude_wide.html
│ ├── fidler_thompson.html
│ ├── get.ci.partial.eta.squared.html
│ ├── goggles.html
│ ├── index.html
│ └── viagra.html
├── search.json
└── sitemap.xml
├── man
├── Eysenck.Rd
├── album.Rd
├── apa.1way.table.Rd
├── apa.2way.table.Rd
├── apa.aov.table.Rd
├── apa.cor.table.Rd
├── apa.d.table.Rd
├── apa.ezANOVA.table.Rd
├── apa.knit.table.for.papaja.Rd
├── apa.knit.table.for.pdf.Rd
├── apa.reg.table.Rd
├── apa.save.Rd
├── apaTables.Rd
├── dating_wide.Rd
├── drink_attitude_wide.Rd
├── fidler_thompson.Rd
├── get.ci.partial.eta.squared.Rd
├── goggles.Rd
└── viagra.Rd
├── tests
├── testthat.R
└── testthat
│ ├── test_anova_ci.R
│ ├── test_beta.R
│ ├── test_d_calc.R
│ ├── test_deltaR2_ci.R
│ └── test_r_ci.R
└── vignettes
├── .gitignore
└── articles
├── Table1.jpg
├── Table10.jpg
├── Table11.jpg
├── Table2.jpg
├── Table3.jpg
├── Table4.jpg
├── Table5.jpg
├── Table6.jpg
├── Table7.jpg
├── Table8.jpg
├── Table9.jpg
└── apaTables.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^_pkgdown\.yml$
4 | ^docs$
5 | ^pkgdown$
6 | ^\.github$
7 | ^vignettes/articles$
8 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/workflows/pkgdown.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 | release:
9 | types: [published]
10 | workflow_dispatch:
11 |
12 | name: pkgdown
13 |
14 | jobs:
15 | pkgdown:
16 | runs-on: ubuntu-latest
17 | # Only restrict concurrency for non-PR jobs
18 | concurrency:
19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20 | env:
21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22 | permissions:
23 | contents: write
24 | steps:
25 | - uses: actions/checkout@v3
26 |
27 | - uses: r-lib/actions/setup-pandoc@v2
28 |
29 | - uses: r-lib/actions/setup-r@v2
30 | with:
31 | use-public-rspm: true
32 |
33 | - uses: r-lib/actions/setup-r-dependencies@v2
34 | with:
35 | extra-packages: any::pkgdown, local::.
36 | needs: website
37 |
38 | - name: Build site
39 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
40 | shell: Rscript {0}
41 |
42 | - name: Deploy to GitHub pages 🚀
43 | if: github.event_name != 'pull_request'
44 | uses: JamesIves/github-pages-deploy-action@v4.4.1
45 | with:
46 | clean: false
47 | branch: gh-pages
48 | folder: docs
49 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .DS_Store
5 | ~$ovatest.doc
6 | .doc
7 | .docx
8 | .rtf
9 | inst/doc
10 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: apaTables
2 | Version: 3.0.0
3 | Authors@R: person("David", "Stanley", , "dstanley@uoguelph.ca", role = c("aut", "cre"))
4 | Title: Create American Psychological Association (APA) Style Tables
5 | Description: A common task faced by researchers is the creation of APA style
6 | (i.e., American Psychological Association style) tables from statistical
7 | output. In R a large number of function calls are often needed to obtain all of
8 | the desired information for a single APA style table. As well, the process of
9 | manually creating APA style tables in a word processor is prone to transcription
10 | errors. This package creates Word files (.doc files) and latex code containing APA style tables
11 | for several types of analyses. Using this package minimizes transcription errors
12 | and reduces the number commands needed by the user.
13 | URL: https://github.com/dstanley4/apaTables, http://dstanley4.github.io/apaTables/
14 | BugReports: https://github.com/dstanley4/apaTables/issues
15 | Depends:
16 | R (>= 3.1.2)
17 | Imports:
18 | stats,
19 | utils,
20 | methods,
21 | car,
22 | broom,
23 | dplyr,
24 | kableExtra,
25 | stringr,
26 | papaja
27 | Suggests:
28 | testthat,
29 | MBESS,
30 | ez,
31 | tidyr,
32 | knitr,
33 | rmarkdown
34 | Encoding: UTF-8
35 | RoxygenNote: 7.3.1
36 | License: MIT License + file LICENSE
37 | LazyData: true
38 | Date: 2023-6-29
39 | VignetteBuilder: knitr
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2016
2 | COPYRIGHT HOLDER: David J. Stanley
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(print,apa.table)
4 | S3method(print,apa_table)
5 | export(apa.1way.table)
6 | export(apa.2way.table)
7 | export(apa.aov.table)
8 | export(apa.cor.table)
9 | export(apa.d.table)
10 | export(apa.ezANOVA.table)
11 | export(apa.knit.table.for.papaja)
12 | export(apa.knit.table.for.pdf)
13 | export(apa.reg.table)
14 | export(apa.save)
15 | export(get.ci.partial.eta.squared)
16 | import(methods)
17 | importFrom("broom","glance")
18 | importFrom("broom","tidy")
19 | importFrom("dplyr","as_tibble")
20 | importFrom("dplyr","mutate")
21 | importFrom("dplyr","select")
22 | importFrom("papaja","apa_table")
23 | importFrom("stats","anova")
24 | importFrom("stats","confint")
25 | importFrom("stats","cor.test")
26 | importFrom("stats","lm")
27 | importFrom("stats","median")
28 | importFrom("stats","na.omit")
29 | importFrom("stats","pf")
30 | importFrom("stats","qnorm")
31 | importFrom("stats","rnorm")
32 | importFrom("stats","sd")
33 | importFrom("stats","t.test")
34 | importFrom("stats","var")
35 | importFrom("stringr","str_to_sentence")
36 | importFrom("stringr","str_to_title")
37 | importFrom("utils","capture.output")
38 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # apaTable 3.0
2 |
3 | ## New features
4 |
5 | * Support for latex tables via the new command apa.knit.table.for.pdf()
6 |
--------------------------------------------------------------------------------
/R/apaANOVATable1way.R:
--------------------------------------------------------------------------------
1 | #' Creates a table of means and standard deviations for a 1-way ANOVA design in APA style
2 | #' @param iv Name of independent variable column in data frame
3 | #' @param dv Name of dependent variable column in data frame
4 | #' @param data Project data frame name
5 | #' @param filename (optional) Output filename document filename (must end in .rtf or .doc only)
6 | #' @param table.number Integer to use in table number output line
7 | #' @param show.conf.interval (TRUE/FALSE) Display confidence intervals in table.
8 | #' @param landscape (TRUE/FALSE) Make RTF file landscape
9 | #' @return APA table object
10 | #' @examples
11 | #' # Example 1: 1-way from Field et al. (2012) Discovery Statistics Using R
12 | #'
13 | #' table1 <- apa.1way.table(iv = dose, dv = libido,
14 | #' data = viagra, table.number = 1)
15 | #'
16 | #' apa.save(filename = "table1.doc", table1)
17 | #'
18 | #' # Create a table for your PDF
19 | #' # Include the line below in your rmarkdown or Quarto document
20 | #' apa.knit.table.for.pdf(table1)
21 | #'
22 | #' # delete demo file
23 | #' if (file.exists("table1.doc")) {
24 | #' file.remove("table1.doc")
25 | #' }
26 | #' @export
27 | apa.1way.table <- function(iv, dv, data,filename=NA, table.number=0, show.conf.interval=FALSE, landscape=FALSE){
28 | data <- as.data.frame(data)
29 |
30 | if (is.na(filename)) {
31 | make.file.flag=FALSE
32 | } else {
33 | make.file.flag=TRUE
34 | }
35 |
36 | if (!is.null(data)) {
37 | data.col.names <- colnames(data)
38 | } else {
39 | cat("apa.mean.table error:\n")
40 | cat("data not specified.\n\n")
41 | return(FALSE)
42 | }
43 |
44 | iv.sub <- substitute(iv)
45 | is.iv <- is.valid.name(iv.sub,data.col.names)
46 |
47 | dv.sub <- substitute(dv)
48 | is.dv <- is.valid.name(dv.sub, data.col.names)
49 |
50 |
51 | if (is.dv==FALSE) {
52 | cat("apa.mean.table error:\n")
53 | cat("A valid dependent variable (dv) must be specified.\n")
54 | return(FALSE)
55 | }
56 |
57 | if (is.iv==FALSE) {
58 | cat("apa.mean.table error:\n")
59 | cat("A valid independent variables (iv) must be specified.\n\n")
60 | return(FALSE)
61 | }
62 |
63 | iv.name <- deparse(iv.sub)
64 | dv.name <- deparse(dv.sub)
65 |
66 | iv <- as.factor(data[,iv.name])
67 | dv <- data[,dv.name]
68 |
69 | tables.out = one.way.table.console.and.rtf(iv=iv,dv=dv,iv.name=iv.name,dv.name=dv.name,show.conf.interval = show.conf.interval,table.number)
70 | tbl.console <- tables.out$tbl.console
71 | txt.body <- tables.out$txt.body
72 |
73 | if (is.na(table.number)) {
74 | table.number = 0
75 | tbl.console$table.number = 0
76 | }
77 |
78 |
79 | #Create RTF code
80 | table.title <- sprintf("Descriptive Statistics for %s For Each Level of %s. ", stringr::str_to_sentence(dv.name), stringr::str_to_sentence(iv.name))
81 | table.note <- "{\\i M} = mean. {\\i SD} = standard deviation."
82 |
83 | if (show.conf.interval==TRUE) {
84 | ci.txt <- "{\\i CI} = confidence interval."
85 | table.note <- paste(table.note,ci.txt)
86 | }
87 |
88 | if (make.file.flag == TRUE) {
89 | write.rtf.table(filename = filename,txt.body = txt.body,table.title = table.title, table.note = table.note, table.number=table.number,landscape=landscape)
90 | }
91 |
92 |
93 | # Ver 3.0 add ons
94 | latex.table.note <- "\\\\textit{Note}. \\\\textit{M} = mean. \\\\textit{SD} = standard deviation. "
95 | if (show.conf.interval==TRUE) {
96 | latex.ci.txt <- "CI = confidence interval."
97 | latex.table.note <- paste(latex.table.note, latex.ci.txt)
98 | }
99 |
100 | tbl.console$latex.column.labels <-tables.out$latex.column.labels
101 | tbl.console$latex.column.centering <- make_markdown_column_alignment(tables.out$latex.column.labels)
102 | tbl.console$latex.table.note <- latex.table.note
103 | tbl.console$latex.table.title <- sprintf("Descriptive Statistics for %s For Each Level of %s. ",stringr::str_to_sentence(dv.name),stringr::str_to_sentence(iv.name))
104 |
105 | tbl.console$rtf.body <- txt.body
106 | tbl.console$rtf.table.title <- table.title
107 | tbl.console$rtf.table.note <- table.note
108 |
109 | tbl.console$landscape <- landscape
110 | tbl.console$table.type <- "oneway"
111 |
112 |
113 | return(tbl.console)
114 | }
115 |
116 |
117 |
118 |
119 | apa.1way.table.work <- function(iv,dv,iv.name,dv.name, show.conf.interval) {
120 | iv.levels <- levels(iv)
121 | iv.level.numbers <- 1:length(iv.levels)
122 |
123 | my.means <- matrix(" ",length(iv.levels),1)
124 | my.sds <- matrix(" ",length(iv.levels),1)
125 | my.ci <- matrix(" ",length(iv.levels),1)
126 |
127 | for (iv.cur in iv.levels) {
128 | is.iv.level <- iv == iv.cur
129 | r.num.iv <- iv.level.numbers[iv.levels == iv.cur]
130 |
131 | cur.cell <- dv[is.iv.level]
132 | cell.mean <- mean(cur.cell,na.rm=TRUE)
133 | cell.sd <- stats::sd(cur.cell,na.rm=TRUE)
134 |
135 | my.means[r.num.iv,1] <- sprintf("%1.2f",cell.mean)
136 | my.sds[r.num.iv,1] <- sprintf("%1.2f",cell.sd)
137 | LL <- get.ci.mean(cur.cell)$lower.conf.limit
138 | UL <- get.ci.mean(cur.cell)$upper.conf.limit
139 | ci_string <- sprintf("[%s, %s]", LL,UL)
140 | my.ci[r.num.iv,1] <- ci_string
141 | }
142 |
143 |
144 | if (show.conf.interval==FALSE) {
145 | data.table <- data.frame(my.means,my.sds,stringsAsFactors = FALSE)
146 | names(data.table) <- c("M","SD")
147 | } else {
148 | data.table <- data.frame(my.means,my.ci,my.sds,stringsAsFactors = FALSE)
149 | names(data.table) <- c("M","CI","SD")
150 | }
151 |
152 | return(data.table)
153 | }
154 |
155 | one.way.table.console.and.rtf <- function(iv,dv,iv.name, dv.name, show.conf.interval=FALSE,table.number,add.blank.header=FALSE) {
156 | table.out <- apa.1way.table.work(iv=iv,dv=dv,iv.name=iv.name,dv.name=dv.name, show.conf.interval=show.conf.interval)
157 |
158 | #add first name column
159 | level.names <- as.data.frame(matrix(levels(iv),ncol=1))
160 | names(level.names) <- iv.name
161 | table.out <- cbind(level.names,table.out)
162 | names(table.out)[1] <- "IV"
163 |
164 |
165 |
166 | #make console output
167 | table.title <- sprintf("Descriptive Statistics for %s For Each Level of %s. ",stringr::str_to_sentence(dv.name),stringr::str_to_sentence(iv.name))
168 |
169 | table.body <- table.out
170 | names(table.body) <- get_oneway_column_names(table.body)
171 | names(table.body)[1] <- iv.name
172 |
173 | table.note <- "Note. M = mean. SD = standard deviation.\n"
174 | if (show.conf.interval==TRUE) {
175 | ci.txt <- "CI = confidence interval."
176 | table.note <- paste(table.note,ci.txt,sep="")
177 | }
178 | tbl.console <- list()
179 | tbl.console <- list(table.number = table.number,
180 | table.title = table.title,
181 | table.body = table.body,
182 | table.note = table.note)
183 | class(tbl.console) <- "apa.table"
184 |
185 |
186 | #make rtf header row
187 | table.out.rtf <- table.out
188 | names(table.out.rtf) <- get_oneway_rtf_column_names(table.out)
189 | names(table.out.rtf)[1] <- iv.name
190 | #names(table.out.rtf) <- sprintf("{\\i %s}",names(table.out))
191 | #make latex column names
192 | latex.column.labels <- get_oneway_latex_column_names(table.out)
193 | latex.column.labels[1] <- iv.name
194 |
195 | #make rtf table
196 | rtfTable <- RtfTable$new(isHeaderRow=TRUE)
197 | rtfTable$setTableContent(as.matrix(table.out.rtf))
198 | rtfTable$setRowFirstColumnJustification("right")
199 |
200 | cell.widths <- get_oneway_rtf_column_widths(table.out)
201 | rtfTable$setCellWidthsInches(cellWidths = cell.widths)
202 | txt.body <- rtfTable$getTableAsRTF(isExtraSpacing=FALSE,FALSE)
203 |
204 | if (add.blank.header==TRUE) {
205 | #add extra top row
206 | #Create RTF code for IV2 name
207 | cell.widths <- sum(rtfTable$cellWidthsInches)
208 |
209 | h1.num.cells <- 1
210 | rtf.table.h1 <- RtfTable$new(isHeaderRow=FALSE)
211 | rtf.table.h1$setTableContent(matrix(c("placeholder"),nrow = 1))
212 | rtf.table.h1$setCellWidthsInches(cellWidths = cell.widths)
213 | rtf.table.h1$setDecimalTabWidthsProportions(rep(0,1)) #no tabs, ensures centering
214 | rtf.table.h1$setRowFirstColumnJustification("center")
215 | txt.h1 <- rtf.table.h1$getTableAsRTF(isExtraSpacing=TRUE,FALSE)
216 | txt.body <- c(txt.h1,txt.body)
217 | }
218 |
219 |
220 |
221 | output <- list()
222 | output$tbl.console <- tbl.console
223 | output$txt.body <- txt.body
224 | output$latex.column.labels <- latex.column.labels
225 | return(output)
226 | }
227 |
228 |
229 | oneway_column_width <- function(column_name) {
230 | narrow <- .60
231 | wide <- .95
232 |
233 | switch(column_name,
234 | IV = wide*1.5,
235 | M = narrow,
236 | CI = wide*1.25,
237 | SD = narrow)
238 | }
239 |
240 |
241 |
242 | get_oneway_rtf_column_widths <- function(df) {
243 | n <- names(df)
244 | width_out <- c()
245 | for (i in 1:length(n)) {
246 | width_out[i] <-oneway_column_width(n[i])
247 | }
248 | return(width_out)
249 | }
250 |
251 |
252 | oneway_rtf_column_names <- function(column_name) {
253 | switch(column_name,
254 | IV = "IV",
255 | M = "{\\i M}",
256 | CI = "95% CI",
257 | SD = "{\\i SD}")
258 | }
259 |
260 | oneway_latex_column_names <- function(column_name) {
261 | switch(column_name,
262 | IV = "IV",
263 | M = "$M$",
264 | CI = "95\\% CI",
265 | SD = "$SD$")
266 | }
267 |
268 | get_oneway_latex_column_names <- function(df) {
269 | n <- names(df)
270 | names_out <- c()
271 | for (i in 1:length(n)) {
272 | names_out[i] <-oneway_latex_column_names(n[i])
273 | }
274 | return(names_out)
275 | }
276 |
277 |
278 | get_oneway_rtf_column_names <- function(df) {
279 | n <- names(df)
280 | names_out <- c()
281 | for (i in 1:length(n)) {
282 | names_out[i] <-oneway_rtf_column_names(n[i])
283 | }
284 | return(names_out)
285 | }
286 |
287 |
288 | oneway_column_names <- function(column_name) {
289 | switch(column_name,
290 | IV = "IV",
291 | M = "M",
292 | CI = "M_95%_CI",
293 | SD = "SD")
294 | }
295 |
296 | get_oneway_column_names <- function(df) {
297 | n <- names(df)
298 | names_out <- c()
299 | for (i in 1:length(n)) {
300 | names_out[i] <-oneway_column_names(n[i])
301 | }
302 | return(names_out)
303 | }
304 |
305 |
306 | make_markdown_column_alignment <- function(column_names) {
307 | N = length(column_names)
308 | output = rep("r", N)
309 | output[1] <- "l"
310 | return(output)
311 | }
312 |
--------------------------------------------------------------------------------
/R/data-album.R:
--------------------------------------------------------------------------------
1 | #' @title album data from textbook
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name album
5 | #' @usage data(album)
6 | #' @format A data frame with 200 rows and 4 variables:
7 | #' \describe{
8 | #' \item{adverts}{Amount spent of adverts, thousands of pounds}
9 | #' \item{sales}{Album sales in thousands}
10 | #' \item{airplay}{Number of times songs from album played on radio week prior to release}
11 | #' \item{attract}{Attractiveness rating of band members}
12 | #' }
13 | #' @description A data set from Field et al (2012)
14 | #' @references Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
15 | #' @source \url{https://studysites.sagepub.com/dsur/study/}
16 | "album"
17 | NULL
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/R/data-dating_wide.R:
--------------------------------------------------------------------------------
1 | #' @title dating data from textbook
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name dating_wide
5 | #' @usage data(dating_wide)
6 | #' @format A data frame with 20 rows and 11 columns. Gender is a between subjects variable. Looks and Personality are within subject variables. Both gender and particpant are factors.
7 | #' \describe{
8 | #' \item{participant}{Factor: Participant ID number}
9 | #' \item{gender}{Factor: Gender: Male/Female}
10 | #' \item{attractive_high}{Date rating where looks=attractive and personality=high}
11 | #' \item{average_high}{Date rating where looks=average and personality=high}
12 | #' \item{ugly_high}{Date rating where looks=ugly and personality=high}
13 | #' \item{attractive_some}{Date rating where looks=attractive and personality=some}
14 | #' \item{average_some}{Date rating where looks=average and personality=some}
15 | #' \item{ugly_some}{Date rating where looks=ugly and personality=some}
16 | #' \item{attractive_none}{Date rating where looks=attractive and personality=none}
17 | #' \item{average_none}{Date rating where looks=average and personality=none}
18 | #' \item{ugly_none}{Date rating where looks=ugly and personality=none}
19 | #' }
20 | #' @description A data set from Field et al (2012)
21 | #' @references Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
22 | #' @source \url{https://studysites.sagepub.com/dsur/study/}
23 | "dating_wide"
24 | NULL
25 |
26 |
27 |
--------------------------------------------------------------------------------
/R/data-drink_attitude_wide.R:
--------------------------------------------------------------------------------
1 | #' @title drink attitude data from textbook
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name drink_attitude_wide
5 | #' @usage data(drink_attitude_wide)
6 | #' @format A data frame with 20 rows and 10 columns. Drink and Imagery are within subject variables. Particpant is a factor.
7 | #' \describe{
8 | #' \item{participant}{Factor: Participant ID number}
9 | #' \item{beer_positive}{Attitude where drink=beer and imagery=positive}
10 | #' \item{beer_negative}{Attitude where drink=beer and imagery=negative}
11 | #' \item{beer_neutral}{Attitude where drink=beer and imagery=neutral}
12 | #' \item{wine_positive}{Attitude where drink=wine and imagery=positive}
13 | #' \item{wine_negative}{Attitude where drink=wine and imagery=negative}
14 | #' \item{wine_neutral}{Attitude where drink=wine and imagery=neutral}
15 | #' \item{water_positive}{Attitude where drink=water and imagery=positive}
16 | #' \item{water_negative}{Attitude where drink=water and imagery=negative}
17 | #' \item{water_neutral}{Attitude where drink=water and imagery=neutral}
18 | #' }
19 | #' @description A data set from Field et al (2012)
20 | #' @references Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
21 | #' @source \url{https://studysites.sagepub.com/dsur/study/}
22 | "drink_attitude_wide"
23 | NULL
24 |
25 |
26 |
--------------------------------------------------------------------------------
/R/data-eysenck.R:
--------------------------------------------------------------------------------
1 | #' @title Eysenck data
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name Eysenck
5 | #' @usage data(Eysenck)
6 | #' @format A data frame with 100 rows and 3 variables:
7 | #' \describe{
8 | #' \item{Age}{Young or Old}
9 | #' \item{Condition}{Experimental learning condition}
10 | #' \item{Recall}{Level of word recall}
11 | #' }
12 | #' @description A data set from Howell (2012)
13 | #' @references Howell, D. (2012). Statistical methods for psychology. Cengage Learning.
14 | #' @source \url{https://www.uvm.edu/~statdhtx/methods8/DataFiles/Tab13-2.dat}
15 | "Eysenck"
16 | NULL
17 |
--------------------------------------------------------------------------------
/R/data-fidler_thompson.R:
--------------------------------------------------------------------------------
1 | #' @title Fidler & Thompson (2001) Fixed-Effects ANOVA data
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name fidler_thompson
5 | #' @usage data(fidler_thompson)
6 | #' @format A data frame with 24 rows and 3 variables:
7 | #' \describe{
8 | #' \item{a}{Independent variable: a}
9 | #' \item{b}{Independent variable: b}
10 | #' \item{dv}{Dependent variable: dv}
11 | #' }
12 | #' @description A data set from Fidler & Thompson (2001)
13 | #' @references Fidler, F. & Thompson, B. (2001). Computing correct confidence intervals for ANOVA fixed- and random-effects effect sizes. Educational and Psychological Measurement, 61, 575-604.
14 | "fidler_thompson"
15 | NULL
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/R/data-goggles.R:
--------------------------------------------------------------------------------
1 | #' @title goggles data from textbook
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name goggles
5 | #' @usage data(goggles)
6 | #' @format A data frame with 48 rows and 3 variables:
7 | #' \describe{
8 | #' \item{participant}{Participant identification number}
9 | #' \item{gender}{Gender of participant}
10 | #' \item{alcohol}{Amount alcohol consumed }
11 | #' \item{attractiveness}{Perceived attractiveness}
12 | #' }
13 | #' @description A data set from Field et al (2012)
14 | #' @references Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
15 | #' @source \url{https://studysites.sagepub.com/dsur/study/}
16 | "goggles"
17 | NULL
18 |
--------------------------------------------------------------------------------
/R/data-viagra.R:
--------------------------------------------------------------------------------
1 | #' @title viagra data from textbook
2 | #' @docType data
3 | #' @keywords datasets
4 | #' @name viagra
5 | #' @usage data(viagra)
6 | #' @format A data frame with 15 rows and 2 variables:
7 | #' \describe{
8 | #' \item{dose}{Level of viagra dose}
9 | #' \item{libido}{Libido after taking viagra}
10 | #' }
11 | #' @description A data set from Field et al (2012)
12 | #' @references Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
13 | #' @source \url{https://studysites.sagepub.com/dsur/study/}
14 | "viagra"
15 | NULL
16 |
17 |
18 |
--------------------------------------------------------------------------------
/R/deltaR2.R:
--------------------------------------------------------------------------------
1 |
2 | get_sr2_ci <- function(sr2, R2, n, conf_level) {
3 | R2_2 <- R2
4 | R2_1 <- R2-sr2
5 | ci <- get_deltaR2_ci(R2_2 = R2_2,R2_1=R2_1,n=n, conf_level = conf_level)
6 | return(ci)
7 | }
8 |
9 |
10 | get_deltaR2_ci <- function(R2_2,R2_1,n,conf_level=.95){
11 | #Alf Jr, E. F., & Graf, R. G. (1999). Asymptotic confidence limits for the difference between two squared multiple correlations: A simplified approach. Psychological Methods, 4(1), 70.
12 | #Case 2 from paper
13 |
14 | z <- qnorm((1-((1-conf_level)/2)))
15 |
16 | r20A <- R2_2
17 | r20B <- R2_1
18 |
19 | r0A <- sqrt(r20A)
20 | r0B <- sqrt(r20B)
21 |
22 | rAB <- r0B/r0A
23 | r2AB <- rAB^2
24 |
25 | var_delta_r2 <- (4*r20A*(1-r20A)^2)/n + (4*r20B*(1-r20B)^2)/n - 8*r0A*r0B*(.5*(2*rAB-r0A*r0B)*(1-r20A - r20B - r2AB)+rAB^3)/n
26 |
27 | LL <- (r20A -r20B) - z*sqrt(var_delta_r2)
28 | UL <- (r20A -r20B) + z*sqrt(var_delta_r2)
29 |
30 | output <- list()
31 | output$LL <- LL
32 | output$UL <- UL
33 | return(output)
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/R/etaSquaredCI.R:
--------------------------------------------------------------------------------
1 | #' Calculates confidence interval for partial eta-squared in a fixed-effects ANOVA
2 | #' @param F.value The F-value for the fixed-effect
3 | #' @param df1 Degrees of freedom for the fixed-effect
4 | #' @param df2 Degrees of freedom error
5 | #' @param conf.level Confidence level (0 to 1). For partial eta-squared a confidence level of .90 is traditionally used rather than .95.
6 | #' @return List with confidence interval values (LL and UL)
7 | #' @examples
8 | #' # Smithson (2001) p. 619
9 | #' get.ci.partial.eta.squared(F.value=6.00, df1=1, df2=42, conf.level=.90)
10 | #' get.ci.partial.eta.squared(F.value=2.65, df1=6, df2=42, conf.level=.90)
11 | #' get.ci.partial.eta.squared(F.value=2.60, df1=6, df2=42, conf.level=.90)
12 | #'
13 | #' # Fidler & Thompson (2001) Fixed Effects 2x4 p. 594 (Table 6) / p. 596 (Table 8)
14 | #' get.ci.partial.eta.squared(F.value=1.50, df1=1, df2=16, conf.level=.90)
15 | #' get.ci.partial.eta.squared(F.value=4.00, df1=3, df2=16, conf.level=.90)
16 | #' get.ci.partial.eta.squared(F.value=1.50, df1=3, df2=16, conf.level=.90)
17 | #' @export
18 | get.ci.partial.eta.squared <- function(F.value, df1, df2, conf.level=.90) {
19 | F_value <- F.value
20 |
21 | conf_level <- conf.level
22 |
23 | LL_partial_eta2 <- NA
24 | UL_partial_eta2 <- NA
25 |
26 | if (requireNamespace("MBESS", quietly = TRUE)) {
27 | F_limits <- MBESS::conf.limits.ncf(F=F_value, df.1=df1, df.2=df2, conf.level=conf_level)
28 | LL_lambda <- F_limits$Lower.Limit
29 | UL_lambda <- F_limits$Upper.Limit
30 |
31 |
32 | LL_partial_eta2 <- get_partial_eta2_from_lambda(lambda=LL_lambda, df1=df1, df2=df2)
33 | UL_partial_eta2 <- get_partial_eta2_from_lambda(lambda=UL_lambda, df1=df1, df2=df2)
34 |
35 |
36 | if (is.na(LL_partial_eta2)) {
37 | LL_partial_eta2 <- 0
38 | }
39 |
40 | if (is.na(UL_partial_eta2)) {
41 | UL_partial_eta2 <- 1
42 | }
43 | } else {
44 | cat("\nMBESS package needs to be installed to calculate eta-squared confidence intervals.\n")
45 | }
46 |
47 | output <- list()
48 | output$LL <- LL_partial_eta2
49 | output$UL <- UL_partial_eta2
50 | return(output)
51 | }
52 |
53 |
54 | get_partial_eta2_from_lambda <- function(lambda, df1, df2) {
55 | partial_eta2 <- lambda / (lambda + df1 + df2 + 1)
56 | return(partial_eta2)
57 | }
58 |
59 |
60 |
--------------------------------------------------------------------------------
/R/papajaOutput.R:
--------------------------------------------------------------------------------
1 | #' Create output for papaja
2 | #' @param table_object Previously constructed apaTable object
3 | #' @param latex_font_size A strijg that indicates normalsize, small, footnotesize, scriptsize
4 | #' @return Save status
5 | #' @export
6 | apa.knit.table.for.papaja <- function(table_object, latex_font_size = "footnotesize"){
7 |
8 | #apa.knit.table.for.papaja <- function(table_object, table_note = NULL, table_title = NULL, line_spacing = 1)
9 |
10 |
11 | table_type <- table_object$table.type
12 |
13 | table_out <- " "
14 |
15 | if (table_type == "regression") {
16 | #table_out <- apa.knit.regression.for.papaja(table_object, table_note, table_title, line_spacing)
17 | table_out <- apa.knit.regression.for.papaja(table_object, latex_font_size)
18 | }
19 |
20 |
21 | return(table_out)
22 | }
23 |
24 |
25 | apa.knit.regression.for.papaja <- function(table_object, latex_font_size = "footnotesize"){
26 |
27 |
28 |
29 | table_df <- dplyr::as_tibble(as.matrix(table_object$table_body))
30 | #table_df <- as_tibble(table_df)
31 | table_df$Predictor <- gsub("_", " ", table_df$Predictor)
32 |
33 |
34 |
35 | num_cols <- dim(table_df)[2]
36 |
37 |
38 | tblcolnames = names(table_df)
39 | tblcolnames[2] <- "$b$"
40 | tblcolnames[3] <- "95\\% CI"
41 | tblcolnames[4] <- "$beta$"
42 | tblcolnames[5] <- "95\\% CI"
43 | tblcolnames[6] <- "Unique $R^2$"
44 | tblcolnames[7] <- "95\\% CI"
45 | tblcolnames[8] <- "$r$"
46 |
47 | if (num_cols == 10) {
48 | tblcolnames[10] <- "$\\Delta$ Fit "
49 | }
50 |
51 |
52 | table_note <- table_object$latex.table.note
53 | table_note <- substr(table_note, 17,nchar(table_note))
54 |
55 | table_title <- table_object$latex.table.title
56 | table_title <- gsub("_", " ", table_title)
57 | table_title <- stringr::str_to_title(table_title)
58 |
59 | table_out <- papaja::apa_table(table_df,
60 | format = "latex",
61 | font_size = latex_font_size,
62 | landscape = TRUE,
63 | col.names = tblcolnames,
64 | caption = table_title,
65 | note = table_note,
66 | escape = FALSE)
67 |
68 | table_out[[1]] = gsub(" Delta "," $\\\\Delta$ ", table_out[[1]])
69 | table_out[[1]] = gsub("R2","$R^2$", table_out[[1]])
70 | table_out[[1]] = gsub("\\\\\\\\newline","\\\\newline", table_out[[1]])
71 |
72 |
73 | return(table_out)
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/R/rtfMakeDocument.R:
--------------------------------------------------------------------------------
1 | write.rtf.table <- function(filename,txt.body,landscape=FALSE,paper="us", table.title=NA,table.note=NA,table.number=NA) {
2 | #generate document format code if needed
3 | doc.type <- list()
4 | doc.type$uslandscape <- "\\paperw15840 \\paperh12240 \\margl1440 \\margr1440 \\margt1440 \\margb1440 \\landscape "
5 | doc.type$usportrait <- ""
6 | doc.type$a4landscape <- "\\paperw16834 \\paperh11909 \\margl1440 \\margr1440 \\margt1440 \\margb1440 \\landscape "
7 | doc.type$a4portrait <- ""
8 |
9 | if (!any(paper == c("us","a4"))) {
10 | paper <- "us"
11 | }
12 |
13 | if (landscape == TRUE) {
14 | orientation <- "landscape"
15 | } else {
16 | orientation <- "portrait"
17 | }
18 |
19 | table.number.str <- ""
20 | if (is.na(table.number)) {
21 | table.number.str <- "XX"
22 | } else {
23 | table.number <- round(table.number)
24 | table.number.str <- sprintf("%1.0f",table.number)
25 | }
26 |
27 |
28 |
29 | #document format
30 | doc.spec <- paste(paper,orientation,sep="")
31 | txt.format <- doc.type[[doc.spec]]
32 | txt.start <- "{\\rtf1\\ansi\\deff0 {\\fonttbl {\\f0 Times New Roman;}}"
33 | txt.end <- "}"
34 |
35 | #Table X, title, and note
36 | blank.line <- c("{\\pard \\par}")
37 | number.line <-sprintf("{\\pard Table %s \\par}",table.number.str)
38 | if (is.na(table.title)) {
39 | title.line <- sprintf("{\\pard\\i Table title goes here \\par}")
40 | } else {
41 | title.line <- sprintf("{\\pard\\i %s\\par}",table.title)
42 | }
43 | if (is.na(table.note)) {
44 | note.line <- sprintf("{\\i Table note goes here}")
45 | } else {
46 | note.line <- sprintf("{\\pard \\par}{\\pard{\\i Note.} %s\\par}",table.note)
47 | }
48 | txt.body <- c(number.line,blank.line,title.line, blank.line,txt.body,note.line)
49 |
50 |
51 | file.id <- file(filename,"wt")
52 | writeLines(txt.start,file.id)
53 | if (landscape==TRUE) {
54 | writeLines(txt.format,file.id)
55 | }
56 | length.body <- length(txt.body)
57 | for (i in 1:length.body) {
58 | writeLines(txt.body[i],file.id)
59 | }
60 | writeLines(txt.end,file.id)
61 | close(file.id)
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/R/rtfOutput.R:
--------------------------------------------------------------------------------
1 | #' Save previously constructed APA table objects in a single .doc file
2 | #' @param filename Filename (e.g., my.tables.doc)
3 | #' @param ... apaTable objects to be saved
4 | #' @param paper Use "us" or "a4". Default is "us".
5 | #' @return Save status
6 | #' @examples
7 | #' library(apaTables)
8 | #'
9 | #' table1 <- apa.1way.table(iv = dose, dv = libido,
10 | #' data = viagra, table.number = 1)
11 | #'
12 | #' table2 <- apa.2way.table(iv1 = gender, iv2 = alcohol,
13 | #' dv = attractiveness,
14 | #' data = goggles, table.number = 1)
15 | #'
16 | #' apa.save(filename = "my.tables.doc", table1, table2)
17 | #'
18 | #' # delete demo file
19 | #' if (file.exists("my.tables.doc")) {
20 | #' file.remove("my.tables.doc")
21 | #' }
22 | #' @export
23 | apa.save <- function(filename, ..., paper = "us") {
24 | list_of_tables <- list(...)
25 | write.rtf.document(filename, list_of_tables, paper)
26 | }
27 |
28 | write.rtf.document <- function(filename, list_of_tables, paper="us") {
29 | #generate document format code if needed
30 | doc.type <- list()
31 | doc.type$uslandscape <- "\\paperw15840 \\paperh12240 \\margl1440 \\margr1440 \\margt1440 \\margb1440 \\landscape "
32 | doc.type$usportrait <- ""
33 | doc.type$a4landscape <- "\\paperw16834 \\paperh11909 \\margl1440 \\margr1440 \\margt1440 \\margb1440 \\landscape "
34 | doc.type$a4portrait <- ""
35 |
36 | if (!any(paper == c("us","a4"))) {
37 | paper <- "us"
38 | }
39 |
40 | orientation <- "portrait"
41 | #
42 | # TO DO: Check if only one table and if it is landscape then change below to landscape
43 | #
44 | # if (landscape == TRUE) {
45 | # orientation <- "landscape"
46 | # }
47 |
48 | #document format
49 | doc.spec <- paste(paper,orientation,sep="")
50 | txt.format <- doc.type[[doc.spec]]
51 | txt.start <- "{\\rtf1\\ansi\\deff0 {\\fonttbl {\\f0 Times New Roman;}}"
52 | txt.end <- "}"
53 |
54 | # KEY PART HERE
55 | txt.body <- convert_tables_to_rtf_txt(list_of_tables, paper)
56 |
57 | file.id <- file(filename,"wt")
58 | writeLines(txt.start,file.id)
59 | # if (landscape==TRUE) {
60 | # writeLines(txt.format,file.id)
61 | # }
62 | length.body <- length(txt.body)
63 | for (i in 1:length.body) {
64 | writeLines(txt.body[i],file.id)
65 | }
66 | writeLines(txt.end,file.id)
67 | close(file.id)
68 | }
69 |
70 |
71 | convert_tables_to_rtf_txt <- function(list_of_tables, paper = "us") {
72 |
73 | txt_for_pages <- ""
74 |
75 | number_of_tables <- length(list_of_tables)
76 |
77 |
78 | for(cur_table_number in 1:number_of_tables) {
79 |
80 | start_page_txt <- get_start_page_txt(list_of_tables, cur_table_number, paper)
81 | end_page_txt <- get_end_page_txt(list_of_tables, cur_table_number)
82 | table_for_page_txt <- convert_single_table_to_txt(list_of_tables[[cur_table_number]])
83 |
84 | new_txt_for_pages <- c(start_page_txt, "{", table_for_page_txt, end_page_txt, "}")
85 | txt_for_pages <- c(txt_for_pages, new_txt_for_pages)
86 |
87 | }
88 | return(txt_for_pages)
89 |
90 | }
91 |
92 | get_start_page_txt <- function(list_of_tables, cur_table_number, paper) {
93 | section.type <- list()
94 | section.type$uslandscape <- "\\sectd \\ltrsect\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\pard\\plain \\ltrpar"
95 | section.type$usportrait <- "\\sectd \\ltrsect\\lndscpsxn\\pgwsxn12240\\pghsxn15840\\pard\\plain \\ltrpar"
96 | section.type$a4landscape <- "\\sectd \\ltrsect\\lndscpsxn\\pgwsxn16834\\pghsxn11909\\pard\\plain \\ltrpar"
97 | section.type$a4portrait <- "\\sectd \\ltrsect\\lndscpsxn\\pgwsxn11909\\pghsxn16834\\pard\\plain \\ltrpar"
98 |
99 | if (paper == "us") {
100 | section_landscape_header <- section.type$uslandscape
101 | section_portrait_header <- section.type$usportrait
102 | } else {
103 | section_landscape_header <- section.type$a4landscape
104 | section_portrait_header <- section.type$a4portrait
105 | }
106 |
107 |
108 | number_of_tables <- length(list_of_tables)
109 |
110 | if (cur_table_number == 1) {
111 | start_page_txt <- ""
112 | } else {
113 | cur_is_landscape = list_of_tables[[cur_table_number]]$landscape
114 | prev_is_landscape = list_of_tables[[cur_table_number-1]]$landscape
115 |
116 | if (cur_is_landscape == prev_is_landscape) {
117 | start_page_txt <- ""
118 | } else {
119 | # new section
120 | if (cur_is_landscape) {
121 | start_page_txt <- section_landscape_header
122 | } else {
123 | start_page_txt <- section_portrait_header
124 | }
125 | }
126 | }
127 | return(start_page_txt)
128 | }
129 |
130 |
131 | get_end_page_txt <- function(list_of_tables, cur_table_number) {
132 | number_of_tables <- length(list_of_tables)
133 |
134 | if (cur_table_number == number_of_tables) {
135 | end_page_txt <- " "
136 | } else {
137 | cur_is_landscape = list_of_tables[[cur_table_number]]$landscape
138 | next_is_landscape = list_of_tables[[cur_table_number+1]]$landscape
139 |
140 | if (cur_is_landscape == next_is_landscape) {
141 | end_page_txt <- "\\page"
142 | } else {
143 | end_page_txt <- "\\sect"
144 | }
145 | }
146 | return(end_page_txt)
147 | }
148 |
149 |
150 | convert_single_table_to_txt <- function(cur_table_object){
151 |
152 | if (is.null(cur_table_object$table.number)) {
153 | cur_table_object$table.number <- cur_table_object$table_number
154 | cur_table_object$table.note <- cur_table_object$table_note
155 | }
156 |
157 | table.number<- cur_table_object$table.number
158 | table.number.str <- sprintf("%1.0f",table.number)
159 |
160 | #Table X, title, and note
161 | blank.line <- c("{\\pard \\par}")
162 | number.line <-sprintf("{\\pard Table %s \\par}",table.number.str)
163 | if (is.na(cur_table_object$rtf.table.title)) {
164 | title.line <- sprintf("{\\pard\\i Table title goes here \\par}")
165 | } else {
166 | title.line <- sprintf("{\\pard\\i %s\\par}",cur_table_object$rtf.table.title)
167 | }
168 | if (is.na(cur_table_object$table.note)) {
169 | note.line <- sprintf("{\\i Table note goes here}")
170 | } else {
171 | note.line <- sprintf("{\\pard \\par}{\\pard{\\i Note.} %s\\par}",cur_table_object$rtf.table.note)
172 | }
173 |
174 | txt.body <- cur_table_object$rtf.body
175 |
176 |
177 | txt.body <- c(number.line,blank.line,title.line, blank.line,txt.body,note.line)
178 |
179 | return(txt.body)
180 | }
181 |
182 |
183 |
--------------------------------------------------------------------------------
/R/tests_for_apaTables.R:
--------------------------------------------------------------------------------
1 |
2 | d_value_test1 <- function() {
3 | set.seed(1)
4 | x <- rnorm(10)+1
5 | y <- rnorm(10)
6 | d <- get_d_value(x,y)
7 | return(d)
8 | }
9 |
10 | d_value_test2 <- function() {
11 | set.seed(1)
12 | x <- rnorm(10)+1
13 | y <- rnorm(10)
14 | d <- get_d_value(y,x) #reverse order
15 | return(d)
16 | }
17 |
18 |
19 | cor_test1 <- function() {
20 | a <- datasets::attitude
21 | x <- apa.cor.table(a)
22 | r_apa <- x$table.body[5,5] # should be string .83**
23 | r_CI <- x$table.body[6,5] # should be string [.66, .91]
24 |
25 | apa_m <- x$table.body[1,3]
26 | apa_sd <- x$table.body[1,4]
27 |
28 | output <- list()
29 | output$r <- r_apa
30 | output$CI <- r_CI
31 | output$m <- apa_m
32 | output$sd <- apa_sd
33 |
34 |
35 | return(output)
36 | }
37 |
38 | reg_test1 <- function() {
39 | d <- apaTables::album
40 | albumSales3 <- lm (sales ~ adverts + airplay + attract, data = d)
41 | beta_value <- convert_b_to_beta(summary(albumSales3)$coefficients[2,1],sd(d$adverts),sd(d$sales))
42 | beta_value <- round(beta_value, 7)
43 | return(beta_value)
44 | }
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | [](https://cran.r-project.org/package=apaTables)
3 |
4 | \[
5 |
6 | apaTables Version 3.0
7 | =====================
8 |
9 | A common task faced by researchers is the creation of APA style (i.e., American Psychological Association style) tables from statistical output. In R a large number of function calls are often needed to obtain all of the desired information for a single APA style table. As well, the process of manually creating APA style tables in a word processor is prone to transcription errors. This package creates Word files (.doc files) containing APA style tables for several types of analyses. Using this package minimizes transcription errors and reduces the number commands needed by the user.
10 |
11 | The development version of apaTables R package is hosted here on Github. Current stable version is on the CRAN, see apaTables [here.](https://cran.r-project.org/package=apaTables)
12 |
13 | ### Install Stable 2.0 CRAN Version
14 |
15 | This version do not support latex tables.
16 |
17 |
18 | ``` r
19 | install.packages("apaTables",dep=T)
20 |
21 | library(apaTables)
22 | ```
23 |
24 | ### Install 3.0 Development Version
25 |
26 | This version supports latex tables.
27 |
28 | ``` r
29 | install.packages("remotes")
30 |
31 | remotes::install_github("dstanley4/apaTables")
32 |
33 | library(apaTables)
34 | ```
35 |
36 | Tutorial
37 | --------
38 |
39 | You can learn how to use apaTables [here](https://dstanley4.github.io/apaTables/).
40 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: http://dstanley4.github.io/apaTables/
2 | template:
3 | bootstrap: 5
4 |
5 |
--------------------------------------------------------------------------------
/apaTables.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 5
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 | BuildType: Package
19 | PackageUseDevtools: Yes
20 | PackageInstallArgs: --compact-docs --no-multiarch --with-keep.source
21 | PackageCheckArgs: --as-cran
22 | PackageRoxygenize: rd,collate,namespace,vignette
23 |
--------------------------------------------------------------------------------
/data/Eysenck.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/Eysenck.rda
--------------------------------------------------------------------------------
/data/album.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/album.rda
--------------------------------------------------------------------------------
/data/dating_wide.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/dating_wide.rda
--------------------------------------------------------------------------------
/data/drink_attitude_wide.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/drink_attitude_wide.rda
--------------------------------------------------------------------------------
/data/fidler_thompson.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/fidler_thompson.rda
--------------------------------------------------------------------------------
/data/goggles.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/goggles.rda
--------------------------------------------------------------------------------
/data/viagra.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/data/viagra.rda
--------------------------------------------------------------------------------
/docs/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Page not found (404) • apaTables
9 |
10 |
11 |
12 |
13 |
14 |
18 |
19 |
20 | Skip to contents
21 |
22 |
23 |
24 |
25 |
apaTables
26 |
27 |
3.0.0
28 |
29 |
30 |
31 |
32 |
33 |
34 |
59 |
60 |
61 |
62 |
63 |
64 |
68 |
69 | Content not found. Please use links in the navbar.
70 |
71 |
72 |
73 |
74 |
75 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/docs/LICENSE-text.html:
--------------------------------------------------------------------------------
1 |
2 | License • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 | YEAR: 2016
51 | COPYRIGHT HOLDER: David J. Stanley
52 |
53 |
54 |
55 |
56 |
57 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/docs/articles/Table1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table1.jpg
--------------------------------------------------------------------------------
/docs/articles/Table10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table10.jpg
--------------------------------------------------------------------------------
/docs/articles/Table11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table11.jpg
--------------------------------------------------------------------------------
/docs/articles/Table2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table2.jpg
--------------------------------------------------------------------------------
/docs/articles/Table3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table3.jpg
--------------------------------------------------------------------------------
/docs/articles/Table4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table4.jpg
--------------------------------------------------------------------------------
/docs/articles/Table5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table5.jpg
--------------------------------------------------------------------------------
/docs/articles/Table6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table6.jpg
--------------------------------------------------------------------------------
/docs/articles/Table7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table7.jpg
--------------------------------------------------------------------------------
/docs/articles/Table8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table8.jpg
--------------------------------------------------------------------------------
/docs/articles/Table9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/articles/Table9.jpg
--------------------------------------------------------------------------------
/docs/articles/articles/apaTables.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/articles/index.html:
--------------------------------------------------------------------------------
1 |
2 | Articles • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
50 |
All vignettes
51 |
52 |
53 |
apaTables
54 |
55 |
56 |
57 |
58 |
59 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/docs/authors.html:
--------------------------------------------------------------------------------
1 |
2 | Authors and Citation • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
57 |
58 |
59 |
Citation
60 |
Source: DESCRIPTION
61 |
62 |
Stanley D (2023).
63 | apaTables: Create American Psychological Association (APA) Style Tables .
64 | https://github.com/dstanley4/apaTables, http://dstanley4.github.io/apaTables/.
65 |
66 |
@Manual{,
67 | title = {apaTables: Create American Psychological Association (APA) Style Tables},
68 | author = {David Stanley},
69 | year = {2023},
70 | note = {https://github.com/dstanley4/apaTables, http://dstanley4.github.io/apaTables/},
71 | }
72 |
73 |
75 |
76 |
77 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/docs/deps/data-deps.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/docs/link.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/docs/news/index.html:
--------------------------------------------------------------------------------
1 |
2 | Changelog • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 |
51 |
52 |
53 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/docs/pkgdown.js:
--------------------------------------------------------------------------------
1 | /* http://gregfranko.com/blog/jquery-best-practices/ */
2 | (function($) {
3 | $(function() {
4 |
5 | $('nav.navbar').headroom();
6 |
7 | Toc.init({
8 | $nav: $("#toc"),
9 | $scope: $("main h2, main h3, main h4, main h5, main h6")
10 | });
11 |
12 | if ($('#toc').length) {
13 | $('body').scrollspy({
14 | target: '#toc',
15 | offset: $("nav.navbar").outerHeight() + 1
16 | });
17 | }
18 |
19 | // Activate popovers
20 | $('[data-bs-toggle="popover"]').popover({
21 | container: 'body',
22 | html: true,
23 | trigger: 'focus',
24 | placement: "top",
25 | sanitize: false,
26 | });
27 |
28 | $('[data-bs-toggle="tooltip"]').tooltip();
29 |
30 | /* Clipboard --------------------------*/
31 |
32 | function changeTooltipMessage(element, msg) {
33 | var tooltipOriginalTitle=element.getAttribute('data-original-title');
34 | element.setAttribute('data-original-title', msg);
35 | $(element).tooltip('show');
36 | element.setAttribute('data-original-title', tooltipOriginalTitle);
37 | }
38 |
39 | if(ClipboardJS.isSupported()) {
40 | $(document).ready(function() {
41 | var copyButton = " ";
42 |
43 | $("div.sourceCode").addClass("hasCopyButton");
44 |
45 | // Insert copy buttons:
46 | $(copyButton).prependTo(".hasCopyButton");
47 |
48 | // Initialize tooltips:
49 | $('.btn-copy-ex').tooltip({container: 'body'});
50 |
51 | // Initialize clipboard:
52 | var clipboard = new ClipboardJS('[data-clipboard-copy]', {
53 | text: function(trigger) {
54 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
55 | }
56 | });
57 |
58 | clipboard.on('success', function(e) {
59 | changeTooltipMessage(e.trigger, 'Copied!');
60 | e.clearSelection();
61 | });
62 |
63 | clipboard.on('error', function() {
64 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
65 | });
66 |
67 | });
68 | }
69 |
70 | /* Search marking --------------------------*/
71 | var url = new URL(window.location.href);
72 | var toMark = url.searchParams.get("q");
73 | var mark = new Mark("main#main");
74 | if (toMark) {
75 | mark.mark(toMark, {
76 | accuracy: {
77 | value: "complementary",
78 | limiters: [",", ".", ":", "/"],
79 | }
80 | });
81 | }
82 |
83 | /* Search --------------------------*/
84 | /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */
85 | // Initialise search index on focus
86 | var fuse;
87 | $("#search-input").focus(async function(e) {
88 | if (fuse) {
89 | return;
90 | }
91 |
92 | $(e.target).addClass("loading");
93 | var response = await fetch($("#search-input").data("search-index"));
94 | var data = await response.json();
95 |
96 | var options = {
97 | keys: ["what", "text", "code"],
98 | ignoreLocation: true,
99 | threshold: 0.1,
100 | includeMatches: true,
101 | includeScore: true,
102 | };
103 | fuse = new Fuse(data, options);
104 |
105 | $(e.target).removeClass("loading");
106 | });
107 |
108 | // Use algolia autocomplete
109 | var options = {
110 | autoselect: true,
111 | debug: true,
112 | hint: false,
113 | minLength: 2,
114 | };
115 | var q;
116 | async function searchFuse(query, callback) {
117 | await fuse;
118 |
119 | var items;
120 | if (!fuse) {
121 | items = [];
122 | } else {
123 | q = query;
124 | var results = fuse.search(query, { limit: 20 });
125 | items = results
126 | .filter((x) => x.score <= 0.75)
127 | .map((x) => x.item);
128 | if (items.length === 0) {
129 | items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}];
130 | }
131 | }
132 | callback(items);
133 | }
134 | $("#search-input").autocomplete(options, [
135 | {
136 | name: "content",
137 | source: searchFuse,
138 | templates: {
139 | suggestion: (s) => {
140 | if (s.title == s.what) {
141 | return `${s.dir} > ${s.title}
`;
142 | } else if (s.previous_headings == "") {
143 | return `${s.dir} > ${s.title}
> ${s.what}`;
144 | } else {
145 | return `${s.dir} > ${s.title}
> ${s.previous_headings} > ${s.what}`;
146 | }
147 | },
148 | },
149 | },
150 | ]).on('autocomplete:selected', function(event, s) {
151 | window.location.href = s.path + "?q=" + q + "#" + s.id;
152 | });
153 | });
154 | })(window.jQuery || window.$)
155 |
156 |
157 |
--------------------------------------------------------------------------------
/docs/pkgdown.yml:
--------------------------------------------------------------------------------
1 | pandoc: 3.1.1
2 | pkgdown: 2.0.7
3 | pkgdown_sha: ~
4 | articles:
5 | apaTables: apaTables.html
6 | last_built: 2023-06-26T23:41Z
7 | urls:
8 | reference: http://dstanley4.github.io/apaTables/reference
9 | article: http://dstanley4.github.io/apaTables/articles
10 |
11 |
--------------------------------------------------------------------------------
/docs/reference/Eysenck.html:
--------------------------------------------------------------------------------
1 |
2 | Eysenck data — Eysenck • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Howell (2012)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 100 rows and 3 variables:
Age
63 | Young or Old
64 |
65 | Condition
66 | Experimental learning condition
67 |
68 | Recall
69 | Level of word recall
70 |
71 |
72 |
73 |
77 |
78 |
References
79 |
Howell, D. (2012). Statistical methods for psychology. Cengage Learning.
80 |
81 |
82 |
84 |
85 |
86 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/docs/reference/Rplot001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/docs/reference/Rplot001.png
--------------------------------------------------------------------------------
/docs/reference/album.html:
--------------------------------------------------------------------------------
1 |
2 | album data from textbook — album • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Field et al (2012)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 200 rows and 4 variables:
adverts
63 | Amount spent of adverts, thousands of pounds
64 |
65 | sales
66 | Album sales in thousands
67 |
68 | airplay
69 | Number of times songs from album played on radio week prior to release
70 |
71 | attract
72 | Attractiveness rating of band members
73 |
74 |
75 |
76 |
80 |
81 |
References
82 |
Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
83 |
84 |
85 |
87 |
88 |
89 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/docs/reference/apa.knit.table.for.pdf.html:
--------------------------------------------------------------------------------
1 |
2 | Create latex output for an apaTables object — apa.knit.table.for.pdf • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
Create latex output for an apaTables object
53 |
54 |
55 |
56 |
Usage
57 |
apa.knit.table.for.pdf (
58 | table_object ,
59 | table_note = NULL ,
60 | table_title = NULL ,
61 | line_spacing = 1
62 | )
63 |
64 |
65 |
66 |
Arguments
67 |
table_object
68 | Previously constructed apaTable object
69 |
70 |
71 | table_note
72 | Replace default table note with this text
73 |
74 |
75 | table_title
76 | Replace default table title with this text
77 |
78 |
79 | line_spacing
80 | Line spacing multiplier for table
81 |
82 |
83 |
84 |
Value
85 |
86 |
87 |
Save status
88 |
89 |
90 |
92 |
93 |
94 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/docs/reference/apa.save.html:
--------------------------------------------------------------------------------
1 |
2 | Save previously constructed APA table objects in a single .doc file — apa.save • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
Save previously constructed APA table objects in a single .doc file
53 |
54 |
55 |
56 |
Usage
57 |
apa.save ( filename , ... , paper = "us" )
58 |
59 |
60 |
61 |
Arguments
62 |
filename
63 | Filename (e.g., my.tables.doc)
64 |
65 |
66 | ...
67 | apaTable objects to be saved
68 |
69 |
70 | paper
71 | Use "us" or "a4". Default is "us".
72 |
73 |
74 |
75 |
Value
76 |
77 |
78 |
Save status
79 |
80 |
81 |
82 |
Examples
83 |
library ( apaTables )
84 |
85 | table1 <- apa.1way.table ( iv = dose , dv = libido ,
86 | data = viagra , table.number = 1 )
87 |
88 | table2 <- apa.2way.table ( iv1 = gender , iv2 = alcohol ,
89 | dv = attractiveness ,
90 | data = goggles , table.number = 1 )
91 |
92 | apa.save ( filename = "my.tables.doc" , table1 , table2 )
93 |
94 | # delete demo file
95 | if ( file.exists ( "my.tables.doc" ) ) {
96 | file.remove ( "my.tables.doc" )
97 | }
98 | #> [1] TRUE
99 |
100 |
101 |
103 |
104 |
105 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/docs/reference/apaTables.html:
--------------------------------------------------------------------------------
1 |
2 | Create American Psychological Association (APA) Style Tables — apaTables • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A common task faced by researchers is the creation of APA style (i.e., American Psychological Association style) tables from statistical output. In R a large number of function calls are often needed to obtain all of the desired information for a single APA style table. As well, the process of manually creating APA style tables in a word processor is prone to transcription errors. This package creates Word files (.doc files) and latex code containing APA style tables for several types of analyses. Using this package minimizes transcription errors and reduces the number commands needed by the user. Examples are provided in this documentation and at http://www.StatsCanBeFun.com .
53 |
54 |
55 |
56 |
57 |
Details
58 |
Bugs and feature requests can be reported at: https://github.com/dstanley4/apaTables/issues
59 |
Tutorial at: https://dstanley4.github.io/apaTables/articles/apaTables.html
60 |
Currently, the following tables can be created:
Correlation tables - Correlation tables (with confidence intervals and descriptive statistics) are created from data frames using apa.cor.table
.
61 | Single "block" regression tables - Single "block" regression tables are created from a regression object using apa.reg.table
.
62 | Multiple "block" regression tables - Multiple "block" regression tables are created from regression objects using apa.reg.table
.
63 | ANOVA tables - An ANOVA F-table can be created via apa.aov.table
from a regression object (i.e. lm output or aov output). Cell mean/standard deviation tables for 1- and 2-way designs are created from data frames using apa.1way.table
and apa.2way.table
.
64 | ezANOVA tables from ez package - An ANOVA F-table from ezANOVA output can be created via apa.ezANOVA.table
.
65 | Standardized mean difference (i.e., d -value) tables (with confidence intervals and descriptive statistics) illustrating all possible paired comparisons using a single independent variable are created from data frames using apa.d.table
.
66 | Package: apaTables Type: Package Version: 3.0.0 Date: 2023-06-29 License: MIT
67 |
71 |
72 |
74 |
75 |
76 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/docs/reference/dating_wide.html:
--------------------------------------------------------------------------------
1 |
2 | dating data from textbook — dating_wide • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Field et al (2012)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 20 rows and 11 columns. Gender is a between subjects variable. Looks and Personality are within subject variables. Both gender and particpant are factors.
participant
63 | Factor: Participant ID number
64 |
65 | gender
66 | Factor: Gender: Male/Female
67 |
68 | attractive_high
69 | Date rating where looks=attractive and personality=high
70 |
71 | average_high
72 | Date rating where looks=average and personality=high
73 |
74 | ugly_high
75 | Date rating where looks=ugly and personality=high
76 |
77 | attractive_some
78 | Date rating where looks=attractive and personality=some
79 |
80 | average_some
81 | Date rating where looks=average and personality=some
82 |
83 | ugly_some
84 | Date rating where looks=ugly and personality=some
85 |
86 | attractive_none
87 | Date rating where looks=attractive and personality=none
88 |
89 | average_none
90 | Date rating where looks=average and personality=none
91 |
92 | ugly_none
93 | Date rating where looks=ugly and personality=none
94 |
95 |
96 |
97 |
101 |
102 |
References
103 |
Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
104 |
105 |
106 |
108 |
109 |
110 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/docs/reference/drink_attitude_wide.html:
--------------------------------------------------------------------------------
1 |
2 | drink attitude data from textbook — drink_attitude_wide • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Field et al (2012)
53 |
54 |
55 |
56 |
Usage
57 |
data ( drink_attitude_wide )
58 |
59 |
60 |
61 |
62 |
A data frame with 20 rows and 10 columns. Drink and Imagery are within subject variables. Particpant is a factor.
participant
63 | Factor: Participant ID number
64 |
65 | beer_positive
66 | Attitude where drink=beer and imagery=positive
67 |
68 | beer_negative
69 | Attitude where drink=beer and imagery=negative
70 |
71 | beer_neutral
72 | Attitude where drink=beer and imagery=neutral
73 |
74 | wine_positive
75 | Attitude where drink=wine and imagery=positive
76 |
77 | wine_negative
78 | Attitude where drink=wine and imagery=negative
79 |
80 | wine_neutral
81 | Attitude where drink=wine and imagery=neutral
82 |
83 | water_positive
84 | Attitude where drink=water and imagery=positive
85 |
86 | water_negative
87 | Attitude where drink=water and imagery=negative
88 |
89 | water_neutral
90 | Attitude where drink=water and imagery=neutral
91 |
92 |
93 |
94 |
98 |
99 |
References
100 |
Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
101 |
102 |
103 |
105 |
106 |
107 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/docs/reference/fidler_thompson.html:
--------------------------------------------------------------------------------
1 |
2 | Fidler & Thompson (2001) Fixed-Effects ANOVA data — fidler_thompson • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Fidler & Thompson (2001)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 24 rows and 3 variables:
a
63 | Independent variable: a
64 |
65 | b
66 | Independent variable: b
67 |
68 | dv
69 | Dependent variable: dv
70 |
71 |
72 |
73 |
74 |
References
75 |
Fidler, F. & Thompson, B. (2001). Computing correct confidence intervals for ANOVA fixed- and random-effects effect sizes. Educational and Psychological Measurement, 61, 575-604.
76 |
77 |
78 |
80 |
81 |
82 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/docs/reference/goggles.html:
--------------------------------------------------------------------------------
1 |
2 | goggles data from textbook — goggles • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Field et al (2012)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 48 rows and 3 variables:
participant
63 | Participant identification number
64 |
65 | gender
66 | Gender of participant
67 |
68 | alcohol
69 | Amount alcohol consumed
70 |
71 | attractiveness
72 | Perceived attractiveness
73 |
74 |
75 |
76 |
80 |
81 |
References
82 |
Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
83 |
84 |
85 |
87 |
88 |
89 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/docs/reference/index.html:
--------------------------------------------------------------------------------
1 |
2 | Function reference • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
50 |
All functions
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | Eysenck
63 |
64 | Eysenck data
65 |
66 |
67 | album
68 |
69 | album data from textbook
70 |
71 |
72 | apa.1way.table()
73 |
74 | Creates a table of means and standard deviations for a 1-way ANOVA design in APA style
75 |
76 |
77 | apa.2way.table()
78 |
79 | Creates a table of means and standard deviations for a 2-way ANOVA design in APA style
80 |
81 |
82 | apa.aov.table()
83 |
84 | Creates a fixed-effects ANOVA table in APA style
85 |
86 |
87 | apa.cor.table()
88 |
89 | Creates a correlation table in APA style with means and standard deviations
90 |
91 |
92 | apa.d.table()
93 |
94 | Creates a d-values for all paired comparisons in APA style
95 |
96 |
97 | apa.ezANOVA.table()
98 |
99 | Creates an ANOVA table in APA style based output of ezANOVA command from ez package
100 |
101 |
102 | apa.knit.table.for.pdf()
103 |
104 | Create latex output for an apaTables object
105 |
106 |
107 | apa.reg.table()
108 |
109 | Creates a regresion table in APA style
110 |
111 |
112 | apa.save()
113 |
114 | Save previously constructed APA table objects in a single .doc file
115 |
116 |
117 | apaTables
118 |
119 | Create American Psychological Association (APA) Style Tables
120 |
121 |
122 | dating_wide
123 |
124 | dating data from textbook
125 |
126 |
127 | drink_attitude_wide
128 |
129 | drink attitude data from textbook
130 |
131 |
132 | fidler_thompson
133 |
134 | Fidler & Thompson (2001) Fixed-Effects ANOVA data
135 |
136 |
137 | get.ci.partial.eta.squared()
138 |
139 | Calculates confidence interval for partial eta-squared in a fixed-effects ANOVA
140 |
141 |
142 | goggles
143 |
144 | goggles data from textbook
145 |
146 |
147 | viagra
148 |
149 | viagra data from textbook
150 |
151 |
152 |
153 |
154 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
--------------------------------------------------------------------------------
/docs/reference/viagra.html:
--------------------------------------------------------------------------------
1 |
2 | viagra data from textbook — viagra • apaTables
6 | Skip to contents
7 |
8 |
9 |
10 |
11 |
apaTables
12 |
13 |
3.0.0
14 |
15 |
16 |
17 |
18 |
19 |
20 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
A data set from Field et al (2012)
53 |
54 |
55 |
59 |
60 |
61 |
62 |
A data frame with 15 rows and 2 variables:
dose
63 | Level of viagra dose
64 |
65 | libido
66 | Libido after taking viagra
67 |
68 |
69 |
70 |
74 |
75 |
References
76 |
Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
77 |
78 |
79 |
81 |
82 |
83 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/docs/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | http://dstanley4.github.io/apaTables/404.html
5 |
6 |
7 | http://dstanley4.github.io/apaTables/LICENSE-text.html
8 |
9 |
10 | http://dstanley4.github.io/apaTables/articles/apaTables.html
11 |
12 |
13 | http://dstanley4.github.io/apaTables/articles/articles/apaTables.html
14 |
15 |
16 | http://dstanley4.github.io/apaTables/articles/index.html
17 |
18 |
19 | http://dstanley4.github.io/apaTables/authors.html
20 |
21 |
22 | http://dstanley4.github.io/apaTables/index.html
23 |
24 |
25 | http://dstanley4.github.io/apaTables/news/index.html
26 |
27 |
28 | http://dstanley4.github.io/apaTables/reference/Eysenck.html
29 |
30 |
31 | http://dstanley4.github.io/apaTables/reference/album.html
32 |
33 |
34 | http://dstanley4.github.io/apaTables/reference/apa.1way.table.html
35 |
36 |
37 | http://dstanley4.github.io/apaTables/reference/apa.2way.table.html
38 |
39 |
40 | http://dstanley4.github.io/apaTables/reference/apa.aov.table.html
41 |
42 |
43 | http://dstanley4.github.io/apaTables/reference/apa.cor.table.html
44 |
45 |
46 | http://dstanley4.github.io/apaTables/reference/apa.d.table.html
47 |
48 |
49 | http://dstanley4.github.io/apaTables/reference/apa.ezANOVA.table.html
50 |
51 |
52 | http://dstanley4.github.io/apaTables/reference/apa.knit.table.for.pdf.html
53 |
54 |
55 | http://dstanley4.github.io/apaTables/reference/apa.reg.table.html
56 |
57 |
58 | http://dstanley4.github.io/apaTables/reference/apa.save.html
59 |
60 |
61 | http://dstanley4.github.io/apaTables/reference/apaTables.html
62 |
63 |
64 | http://dstanley4.github.io/apaTables/reference/dating_wide.html
65 |
66 |
67 | http://dstanley4.github.io/apaTables/reference/drink_attitude_wide.html
68 |
69 |
70 | http://dstanley4.github.io/apaTables/reference/fidler_thompson.html
71 |
72 |
73 | http://dstanley4.github.io/apaTables/reference/get.ci.partial.eta.squared.html
74 |
75 |
76 | http://dstanley4.github.io/apaTables/reference/goggles.html
77 |
78 |
79 | http://dstanley4.github.io/apaTables/reference/index.html
80 |
81 |
82 | http://dstanley4.github.io/apaTables/reference/viagra.html
83 |
84 |
85 |
--------------------------------------------------------------------------------
/man/Eysenck.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-eysenck.R
3 | \docType{data}
4 | \name{Eysenck}
5 | \alias{Eysenck}
6 | \title{Eysenck data}
7 | \format{
8 | A data frame with 100 rows and 3 variables:
9 | \describe{
10 | \item{Age}{Young or Old}
11 | \item{Condition}{Experimental learning condition}
12 | \item{Recall}{Level of word recall}
13 | }
14 | }
15 | \source{
16 | \url{https://www.uvm.edu/~statdhtx/methods8/DataFiles/Tab13-2.dat}
17 | }
18 | \usage{
19 | data(Eysenck)
20 | }
21 | \description{
22 | A data set from Howell (2012)
23 | }
24 | \references{
25 | Howell, D. (2012). Statistical methods for psychology. Cengage Learning.
26 | }
27 | \keyword{datasets}
28 |
--------------------------------------------------------------------------------
/man/album.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-album.R
3 | \docType{data}
4 | \name{album}
5 | \alias{album}
6 | \title{album data from textbook}
7 | \format{
8 | A data frame with 200 rows and 4 variables:
9 | \describe{
10 | \item{adverts}{Amount spent of adverts, thousands of pounds}
11 | \item{sales}{Album sales in thousands}
12 | \item{airplay}{Number of times songs from album played on radio week prior to release}
13 | \item{attract}{Attractiveness rating of band members}
14 | }
15 | }
16 | \source{
17 | \url{https://studysites.sagepub.com/dsur/study/}
18 | }
19 | \usage{
20 | data(album)
21 | }
22 | \description{
23 | A data set from Field et al (2012)
24 | }
25 | \references{
26 | Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
27 | }
28 | \keyword{datasets}
29 |
--------------------------------------------------------------------------------
/man/apa.1way.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaANOVATable1way.R
3 | \name{apa.1way.table}
4 | \alias{apa.1way.table}
5 | \title{Creates a table of means and standard deviations for a 1-way ANOVA design in APA style}
6 | \usage{
7 | apa.1way.table(
8 | iv,
9 | dv,
10 | data,
11 | filename = NA,
12 | table.number = 0,
13 | show.conf.interval = FALSE,
14 | landscape = FALSE
15 | )
16 | }
17 | \arguments{
18 | \item{iv}{Name of independent variable column in data frame}
19 |
20 | \item{dv}{Name of dependent variable column in data frame}
21 |
22 | \item{data}{Project data frame name}
23 |
24 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
25 |
26 | \item{table.number}{Integer to use in table number output line}
27 |
28 | \item{show.conf.interval}{(TRUE/FALSE) Display confidence intervals in table.}
29 |
30 | \item{landscape}{(TRUE/FALSE) Make RTF file landscape}
31 | }
32 | \value{
33 | APA table object
34 | }
35 | \description{
36 | Creates a table of means and standard deviations for a 1-way ANOVA design in APA style
37 | }
38 | \examples{
39 | # Example 1: 1-way from Field et al. (2012) Discovery Statistics Using R
40 |
41 | table1 <- apa.1way.table(iv = dose, dv = libido,
42 | data = viagra, table.number = 1)
43 |
44 | apa.save(filename = "table1.doc", table1)
45 |
46 | # Create a table for your PDF
47 | # Include the line below in your rmarkdown or Quarto document
48 | apa.knit.table.for.pdf(table1)
49 |
50 | # delete demo file
51 | if (file.exists("table1.doc")) {
52 | file.remove("table1.doc")
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/man/apa.2way.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaANOVATable2way.R
3 | \name{apa.2way.table}
4 | \alias{apa.2way.table}
5 | \title{Creates a table of means and standard deviations for a 2-way ANOVA design in APA style}
6 | \usage{
7 | apa.2way.table(
8 | iv1,
9 | iv2,
10 | dv,
11 | data,
12 | filename = NA,
13 | table.number = 0,
14 | show.conf.interval = FALSE,
15 | show.marginal.means = FALSE,
16 | landscape = TRUE
17 | )
18 | }
19 | \arguments{
20 | \item{iv1}{Name of independent variable 1 column in data frame}
21 |
22 | \item{iv2}{Name of independent variable 2 column in data frame}
23 |
24 | \item{dv}{Name of dependent variable column in data frame}
25 |
26 | \item{data}{Project data frame name}
27 |
28 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
29 |
30 | \item{table.number}{Integer to use in table number output line}
31 |
32 | \item{show.conf.interval}{(TRUE/FALSE) Display confidence intervals in table. Negates show.marginal.means = TRUE.}
33 |
34 | \item{show.marginal.means}{(TRUE/FALSE) Show marginal means in output. Only used if show.conf.interval = FALSE.}
35 |
36 | \item{landscape}{(TRUE/FALSE) Make RTF file landscape}
37 | }
38 | \value{
39 | APA table object
40 | }
41 | \description{
42 | Creates a table of means and standard deviations for a 2-way ANOVA design in APA style
43 | }
44 | \examples{
45 | # Example 2: 2-way from Fidler & Thompson (2001)
46 |
47 | table2 <- apa.2way.table(iv1 = a, iv2 = b, dv = dv,
48 | data = fidler_thompson,
49 | landscape = TRUE,
50 | table.number = 2)
51 |
52 |
53 | # Example 3: 2-way from Field et al. (2012) Discovery Statistics Using R
54 |
55 | table3 <- apa.2way.table(iv1 = gender, iv2 = alcohol, dv = attractiveness,
56 | data = goggles, table.number = 3)
57 |
58 |
59 | # Save both Table 2 and Table 3 in a single .doc document
60 | apa.save(filename = "my_tables.doc", table2, table3)
61 |
62 | # Create a table for your PDF
63 | # Include the lines below in your rmarkdown or Quarto document
64 | apa.knit.table.for.pdf(table2)
65 | apa.knit.table.for.pdf(table3)
66 |
67 | # delete demo file
68 | if (file.exists("my_tables.doc")) {
69 | file.remove("my_tables.doc")
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/man/apa.aov.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaAOVTable.R
3 | \name{apa.aov.table}
4 | \alias{apa.aov.table}
5 | \title{Creates a fixed-effects ANOVA table in APA style}
6 | \usage{
7 | apa.aov.table(
8 | lm_output,
9 | filename,
10 | table.number = 0,
11 | conf.level = 0.9,
12 | type = 3
13 | )
14 | }
15 | \arguments{
16 | \item{lm_output}{Regression (i.e., lm) result objects. Typically, one for each block in the regression.}
17 |
18 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
19 |
20 | \item{table.number}{Integer to use in table number output line}
21 |
22 | \item{conf.level}{Level of confidence for interval around partial eta-squared (.90 or .95). A value of .90 is the default, this helps to create consistency between the CI overlapping with zero and conclusions based on the p-value.}
23 |
24 | \item{type}{Sum of Squares Type. Type II or Type III; specify, 2 or 3, respectively. Default value is 3.}
25 | }
26 | \value{
27 | APA table object
28 | }
29 | \description{
30 | Creates a fixed-effects ANOVA table in APA style
31 | }
32 | \examples{
33 |
34 | #Example 1: 1-way from Field et al. (2012) Discovery Statistics Using R
35 | options(contrasts = c("contr.helmert", "contr.poly"))
36 | lm_output <- lm(libido ~ dose, data = viagra)
37 | table1 <- apa.aov.table(lm_output, table.number = 4)
38 |
39 |
40 | # Example 2: 2-way from Fidler & Thompson (2001)
41 | # You must set these contrasts to ensure values match SPSS
42 | options(contrasts = c("contr.helmert", "contr.poly"))
43 | lm_output <- lm(dv ~ a*b, data = fidler_thompson)
44 | table2 <- apa.aov.table(lm_output, table.number = 5)
45 |
46 |
47 | #Example 3: 2-way from Field et al. (2012) Discovery Statistics Using R
48 | # You must set these contrasts to ensure values match SPSS
49 | options(contrasts = c("contr.helmert", "contr.poly"))
50 | lm_output <- lm(attractiveness ~ gender*alcohol, data = goggles)
51 | table3 <- apa.aov.table(lm_output, table.number = 6)
52 |
53 |
54 | # Save all three table in the same .doc document
55 | apa.save(filename = "my_tables.doc", table1, table2, table3)
56 |
57 |
58 | # Create a table for your PDF
59 | # Include the lines below in your rmarkdown or Quarto document
60 | apa.knit.table.for.pdf(table1)
61 | apa.knit.table.for.pdf(table2)
62 | apa.knit.table.for.pdf(table3)
63 |
64 |
65 | # delete demo file
66 | if (file.exists("my_tables.doc")) {
67 | file.remove("my_tables.doc")
68 | }
69 |
70 | }
71 | \references{
72 | Smithson, M. (2001). Correct confidence intervals for various regression effect sizes and parameters: The importance of noncentral distributions in computing intervals. Educational and Psychological Measurement, 61(4), 605-632.
73 |
74 | Fidler, F., & Thompson, B. (2001). Computing correct confidence intervals for ANOVA fixed-and random-effects effect sizes. Educational and Psychological Measurement, 61(4), 575-604.
75 | }
76 |
--------------------------------------------------------------------------------
/man/apa.cor.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaCorrelationTable.R
3 | \name{apa.cor.table}
4 | \alias{apa.cor.table}
5 | \title{Creates a correlation table in APA style with means and standard deviations}
6 | \usage{
7 | apa.cor.table(
8 | data,
9 | filename = NA,
10 | table.number = 0,
11 | show.conf.interval = TRUE,
12 | show.sig.stars = TRUE,
13 | show.pvalue = TRUE,
14 | landscape = TRUE
15 | )
16 | }
17 | \arguments{
18 | \item{data}{Project data frame}
19 |
20 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
21 |
22 | \item{table.number}{Integer to use in table number output line}
23 |
24 | \item{show.conf.interval}{(TRUE/FALSE) Display confidence intervals in table. This argument is deprecated and will be removed from later versions.}
25 |
26 | \item{show.sig.stars}{(TRUE/FALSE) Display stars for significance in table.}
27 |
28 | \item{show.pvalue}{(TRUE/FALSE) Display p-value in table.}
29 |
30 | \item{landscape}{(TRUE/FALSE) Make RTF file landscape}
31 | }
32 | \value{
33 | APA table object
34 | }
35 | \description{
36 | Creates a correlation table in APA style with means and standard deviations
37 | }
38 | \examples{
39 | # View top few rows of attitude data set
40 | head(attitude)
41 |
42 | # Use apa.cor.table function
43 | table1 <- apa.cor.table(attitude)
44 |
45 |
46 | # Save Table 1 in a .doc document
47 | apa.save(filename = "table1.doc", table1)
48 |
49 |
50 | # Create a table for your PDF
51 | # Include the lines below in your rmarkdown or Quarto document
52 | apa.knit.table.for.pdf(table1)
53 |
54 | # delete demo file
55 | if (file.exists("table1.doc")) {
56 | file.remove("table1.doc")
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/man/apa.d.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaDvalueTable.R
3 | \name{apa.d.table}
4 | \alias{apa.d.table}
5 | \title{Creates a d-values for all paired comparisons in APA style}
6 | \usage{
7 | apa.d.table(
8 | iv,
9 | dv,
10 | data,
11 | filename = NA,
12 | table.number = 0,
13 | show.conf.interval = TRUE,
14 | landscape = TRUE
15 | )
16 | }
17 | \arguments{
18 | \item{iv}{Name of independent variable column in data frame for all paired comparisons}
19 |
20 | \item{dv}{Name of dependent variable column in data frame for all paired comparisons}
21 |
22 | \item{data}{Project data frame name}
23 |
24 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
25 |
26 | \item{table.number}{Integer to use in table number output line}
27 |
28 | \item{show.conf.interval}{(TRUE/FALSE) Display confidence intervals in table. This argument is deprecated and will be removed from later versions.}
29 |
30 | \item{landscape}{(TRUE/FALSE) Make RTF file landscape}
31 | }
32 | \value{
33 | APA table object
34 | }
35 | \description{
36 | Creates a d-values for all paired comparisons in APA style
37 | }
38 | \examples{
39 | # View top few rows of viagra data set from Discovering Statistics Using R
40 | head(viagra)
41 |
42 | # Use apa.d.table function
43 | table1 <- apa.d.table(iv = dose, dv = libido, data = viagra)
44 |
45 |
46 | # Save Table 1 in a .doc document
47 | apa.save(filename = "table1.doc", table1)
48 |
49 |
50 | # Create a table for your PDF
51 | # Include the lines below in your rmarkdown or Quarto document
52 | apa.knit.table.for.pdf(table1)
53 |
54 | # delete demo file
55 | if (file.exists("table1.doc")) {
56 | file.remove("table1.doc")
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/man/apa.ezANOVA.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaEZANOVA.R
3 | \name{apa.ezANOVA.table}
4 | \alias{apa.ezANOVA.table}
5 | \title{Creates an ANOVA table in APA style based output of ezANOVA command from ez package}
6 | \usage{
7 | apa.ezANOVA.table(
8 | ez.output,
9 | correction = "GG",
10 | table.title = "",
11 | filename,
12 | table.number = 0
13 | )
14 | }
15 | \arguments{
16 | \item{ez.output}{Output object from ezANOVA command from ez package}
17 |
18 | \item{correction}{Type of sphercity correction: "none", "GG", or "HF" corresponding to none, Greenhouse-Geisser and Huynh-Feldt, respectively.}
19 |
20 | \item{table.title}{String containing text for table title}
21 |
22 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
23 |
24 | \item{table.number}{Integer to use in table number output line}
25 | }
26 | \value{
27 | APA table object
28 | }
29 | \description{
30 | Creates an ANOVA table in APA style based output of ezANOVA command from ez package
31 | }
32 | \examples{
33 | if (requireNamespace("ez", quietly = TRUE)){
34 | if (requireNamespace("apaTables", quietly = TRUE)){
35 | if (requireNamespace("tidyr", quietly = TRUE)){
36 |
37 |
38 | #
39 | # ** Example 1: Between Participant Predictors
40 | #
41 |
42 | goggles <- apaTables::goggles
43 |
44 | # Use ezANOVA
45 | # Be sure use the options command, as below, to ensure sufficient digits
46 |
47 | options(digits = 10)
48 | goggles_results <- ez::ezANOVA(data = goggles,
49 | dv = attractiveness,
50 | between = .(gender, alcohol),
51 | participant ,
52 | detailed = TRUE)
53 |
54 |
55 | # Make APA table - save after all 3 examples
56 | goggles_table <- apa.ezANOVA.table(goggles_results)
57 |
58 | # Create a table for your PDF
59 | # Include the lines below in your rmarkdown or Quarto document
60 | apa.knit.table.for.pdf(goggles_table)
61 |
62 |
63 | #
64 | # ** Example 2: Within Participant Predictors
65 | #
66 |
67 | drink_attitude_wide <- apaTables::drink_attitude_wide
68 |
69 | # Convert data from wide format to long format where one row represents one OBSERVATION.
70 | # Wide format column names MUST represent levels of each variable separated by an underscore.
71 | # See vignette for further details.
72 |
73 | drink_attitude_long <- tidyr::pivot_longer(drink_attitude_wide,
74 | cols = beer_positive:water_neutral,
75 | names_to = c("drink", "imagery"),
76 | names_sep = "_",
77 | values_to = "attitude")
78 |
79 |
80 | drink_attitude_long$drink <- as.factor(drink_attitude_long$drink)
81 | drink_attitude_long$imagery <- as.factor(drink_attitude_long$imagery)
82 |
83 |
84 | # Set contrasts to match Field et al. (2012) textbook output
85 |
86 | alcohol_vs_water <- c(1, 1, -2)
87 | beer_vs_wine <- c(-1, 1, 0)
88 | negative_vs_other <- c(1, -2, 1)
89 | positive_vs_neutral <- c(-1, 0, 1)
90 | contrasts(drink_attitude_long$drink) <- cbind(alcohol_vs_water, beer_vs_wine)
91 | contrasts(drink_attitude_long$imagery) <- cbind(negative_vs_other, positive_vs_neutral)
92 |
93 |
94 | # Use ezANOVA
95 | # Be sure use the options command, as below, to ensure sufficient digits
96 |
97 | options(digits = 10)
98 | drink_attitude_results <- ez::ezANOVA(data = drink_attitude_long,
99 | dv = .(attitude), wid = .(participant),
100 | within = .(drink, imagery),
101 | type = 3, detailed = TRUE)
102 |
103 |
104 | # Make APA table - save after all 3 examples
105 | drink_table <- apa.ezANOVA.table(drink_attitude_results)
106 |
107 | # Create a table for your PDF
108 | # Include the lines below in your rmarkdown or Quarto document
109 | apa.knit.table.for.pdf(drink_table)
110 |
111 |
112 | #
113 | # ** Example 3: Between and Within Participant Predictors
114 | #
115 |
116 | dating_wide <- apaTables::dating_wide
117 |
118 | # Convert data from wide format to long format where one row represents one OBSERVATION.
119 | # Wide format column names MUST represent levels of each variable separated by an underscore.
120 | # See vignette for further details.
121 |
122 |
123 | dating_long <- tidyr::pivot_longer(dating_wide,
124 | cols = attractive_high:ugly_none,
125 | names_to = c("looks", "personality"),
126 | names_sep = "_",
127 | values_to = "date_rating")
128 | #'
129 | dating_long$looks <- as.factor(dating_long$looks)
130 | dating_long$personality <- as.factor(dating_long$personality)
131 |
132 |
133 | # Set contrasts to match Field et al. (2012) textbook output
134 |
135 | some_vs_none <- c(1, 1, -2)
136 | hi_vs_av <- c(1, -1, 0)
137 | attractive_vs_ugly <- c(1, 1, -2)
138 | attractive_vs_average <- c(1, -1, 0)
139 | contrasts(dating_long$personality) <- cbind(some_vs_none, hi_vs_av)
140 | contrasts(dating_long$looks) <- cbind(attractive_vs_ugly, attractive_vs_average)
141 |
142 |
143 | # Use ezANOVA
144 |
145 | options(digits = 10)
146 | dating_results <-ez::ezANOVA(data = dating_long, dv = .(date_rating),
147 | wid = .(participant),
148 | between = .(gender),
149 | within = .(looks, personality),
150 | type = 3, detailed = TRUE)
151 |
152 |
153 | # Make APA table - save after all 3 examples
154 | dating_table <- apa.ezANOVA.table(dating_results)
155 |
156 | # Create a table for your PDF
157 | # Include the lines below in your rmarkdown or Quarto document
158 | apa.knit.table.for.pdf(dating_table)
159 |
160 |
161 | #
162 | # Saving all three tables
163 | #
164 | apa.save("tables_ezANOVA.doc",
165 | goggles_table,
166 | drink_table,
167 | dating_table)
168 |
169 | # delete demo file
170 | if (file.exists("tables_ezANOVA.doc")) {
171 | file.remove("tables_ezANOVA.doc")
172 | }
173 | }}}
174 | }
175 |
--------------------------------------------------------------------------------
/man/apa.knit.table.for.papaja.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/papajaOutput.R
3 | \name{apa.knit.table.for.papaja}
4 | \alias{apa.knit.table.for.papaja}
5 | \title{Create output for papaja}
6 | \usage{
7 | apa.knit.table.for.papaja(table_object, latex_font_size = "footnotesize")
8 | }
9 | \arguments{
10 | \item{table_object}{Previously constructed apaTable object}
11 |
12 | \item{latex_font_size}{A strijg that indicates normalsize, small, footnotesize, scriptsize}
13 | }
14 | \value{
15 | Save status
16 | }
17 | \description{
18 | Create output for papaja
19 | }
20 |
--------------------------------------------------------------------------------
/man/apa.knit.table.for.pdf.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pdfOutput.R
3 | \name{apa.knit.table.for.pdf}
4 | \alias{apa.knit.table.for.pdf}
5 | \title{Create latex output for an apaTables object}
6 | \usage{
7 | apa.knit.table.for.pdf(
8 | table_object,
9 | table_note = NULL,
10 | table_title = NULL,
11 | line_spacing = 1
12 | )
13 | }
14 | \arguments{
15 | \item{table_object}{Previously constructed apaTable object}
16 |
17 | \item{table_note}{Replace default table note with this text}
18 |
19 | \item{table_title}{Replace default table title with this text}
20 |
21 | \item{line_spacing}{Line spacing multiplier for table}
22 | }
23 | \value{
24 | Save status
25 | }
26 | \description{
27 | Create latex output for an apaTables object
28 | }
29 |
--------------------------------------------------------------------------------
/man/apa.reg.table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaRegressionTable.R
3 | \name{apa.reg.table}
4 | \alias{apa.reg.table}
5 | \title{Creates a regresion table in APA style}
6 | \usage{
7 | apa.reg.table(..., filename = NA, table.number = 0, prop.var.conf.level = 0.95)
8 | }
9 | \arguments{
10 | \item{...}{Regression (i.e., lm) result objects. Typically, one for each block in the regression.}
11 |
12 | \item{filename}{(optional) Output filename document filename (must end in .rtf or .doc only)}
13 |
14 | \item{table.number}{Integer to use in table number output line}
15 |
16 | \item{prop.var.conf.level}{Level of confidence (.90 or .95, default .95) for interval around sr2, R2, and Delta R2. Use of .90 confidence level helps to create consistency between the CI overlapping with zero and conclusions based on the p-value for that block (or block difference).}
17 | }
18 | \value{
19 | APA table object
20 | }
21 | \description{
22 | Creates a regresion table in APA style
23 | }
24 | \examples{
25 | # View top few rows of goggles data set
26 | # from Discovering Statistics Using R
27 | head(album)
28 |
29 | # Single block example
30 | blk1 <- lm(sales ~ adverts + airplay, data=album)
31 | apa.reg.table(blk1)
32 | table1 <- apa.reg.table(blk1,table.number = 1)
33 |
34 | # Two block example, more than two blocks can be used
35 | blk1 <- lm(sales ~ adverts, data=album)
36 | blk2 <- lm(sales ~ adverts + airplay + attract, data=album)
37 | table2 <- apa.reg.table(blk1, blk2, table.number = 2)
38 |
39 | # Interaction product-term test with blocks
40 | blk1 <- lm(sales ~ adverts + airplay, data=album)
41 | blk2 <- lm(sales ~ adverts + airplay + I(adverts * airplay), data=album)
42 | table3 <- apa.reg.table(blk1, blk2, table.number = 3)
43 |
44 | # Interaction product-term test with blocks and additional product terms
45 | blk1<-lm(sales ~ adverts + airplay, data=album)
46 | blk2<-lm(sales ~ adverts + airplay + I(adverts*adverts) + I(airplay*airplay), data=album)
47 | blk3<-lm(sales~adverts+airplay+I(adverts*adverts)+I(airplay*airplay)+I(adverts*airplay),data=album)
48 | table4 <- apa.reg.table(blk1,blk2,blk3, table.number = 4)
49 |
50 | #Interaction product-term test with single regression (i.e., semi-partial correlation focus)
51 | blk1 <- lm(sales ~ adverts + airplay + I(adverts * airplay), data=album)
52 | table5 <- apa.reg.table(blk1, table.number = 5)
53 |
54 | # Save Table 1 in a .doc document
55 | apa.save(filename = "regression_tables.doc",
56 | table1,
57 | table2,
58 | table3,
59 | table4,
60 | table5)
61 |
62 | # Create a table for your PDF
63 | # Include the lines below in your rmarkdown or Quarto document
64 | apa.knit.table.for.pdf(table1)
65 | apa.knit.table.for.pdf(table2)
66 | apa.knit.table.for.pdf(table3)
67 | apa.knit.table.for.pdf(table4)
68 | apa.knit.table.for.pdf(table5)
69 |
70 | # delete demo file
71 | if (file.exists("regression_tables.doc")) {
72 | file.remove("regression_tables.doc")
73 | }
74 | }
75 | \references{
76 | sr2 and delta R2 confidence intervals calculated via:
77 |
78 | Alf Jr, E. F., & Graf, R. G. (1999). Asymptotic confidence limits for the difference between two squared multiple correlations: A simplified approach. Psychological Methods, 4(1), 70.
79 |
80 | Note that Algina, Keselman, & Penfield (2008) found this approach can under some circumstances lead to inaccurate CIs on proportion of variance values.
81 | You might consider using the Algina, Keselman, & Penfield (2008) approach via the apa.reg.boot.table function
82 | }
83 |
--------------------------------------------------------------------------------
/man/apa.save.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rtfOutput.R
3 | \name{apa.save}
4 | \alias{apa.save}
5 | \title{Save previously constructed APA table objects in a single .doc file}
6 | \usage{
7 | apa.save(filename, ..., paper = "us")
8 | }
9 | \arguments{
10 | \item{filename}{Filename (e.g., my.tables.doc)}
11 |
12 | \item{...}{apaTable objects to be saved}
13 |
14 | \item{paper}{Use "us" or "a4". Default is "us".}
15 | }
16 | \value{
17 | Save status
18 | }
19 | \description{
20 | Save previously constructed APA table objects in a single .doc file
21 | }
22 | \examples{
23 | library(apaTables)
24 |
25 | table1 <- apa.1way.table(iv = dose, dv = libido,
26 | data = viagra, table.number = 1)
27 |
28 | table2 <- apa.2way.table(iv1 = gender, iv2 = alcohol,
29 | dv = attractiveness,
30 | data = goggles, table.number = 1)
31 |
32 | apa.save(filename = "my.tables.doc", table1, table2)
33 |
34 | # delete demo file
35 | if (file.exists("my.tables.doc")) {
36 | file.remove("my.tables.doc")
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/man/apaTables.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/apaTables.R
3 | \docType{package}
4 | \name{apaTables}
5 | \alias{-package}
6 | \alias{apaTables}
7 | \title{Create American Psychological Association (APA) Style Tables}
8 | \description{
9 | A common task faced by researchers is the creation of APA style (i.e., \emph{American Psychological Association} style) tables from statistical output. In R a large number of function calls are often needed to obtain all of the desired information for a single APA style table. As well, the process of manually creating APA style tables in a word processor is prone to transcription errors. This package creates Word files (.doc files) and latex code containing APA style tables for several types of analyses. Using this package minimizes transcription errors and reduces the number commands needed by the user. Examples are provided in this documentation and at \url{http://www.StatsCanBeFun.com}.
10 | }
11 | \details{
12 | Bugs and feature requests can be reported at: \url{https://github.com/dstanley4/apaTables/issues}
13 |
14 | Tutorial at: \url{https://dstanley4.github.io/apaTables/articles/apaTables.html}
15 |
16 | Currently, the following tables can be created:
17 | \itemize{
18 | \item Correlation tables - Correlation tables (with confidence intervals and descriptive statistics) are created from data frames using \code{\link{apa.cor.table}}.
19 | \item Single "block" regression tables - Single "block" regression tables are created from a regression object using \code{\link{apa.reg.table}}.
20 | \item Multiple "block" regression tables - Multiple "block" regression tables are created from regression objects using \code{\link{apa.reg.table}}.
21 | \item ANOVA tables - An ANOVA F-table can be created via \code{\link{apa.aov.table}} from a regression object (i.e. lm output or aov output). Cell mean/standard deviation tables for 1- and 2-way designs are created from data frames using \code{\link{apa.1way.table}} and \code{\link{apa.2way.table}}.
22 | \item ezANOVA tables from ez package - An ANOVA F-table from ezANOVA output can be created via \code{\link{apa.ezANOVA.table}}.
23 | \item Standardized mean difference (i.e., \emph{d}-value) tables (with confidence intervals and descriptive statistics) illustrating all possible paired comparisons using a single independent variable are created from data frames using \code{\link{apa.d.table}}.
24 | }
25 | \tabular{ll}{
26 | Package: \tab apaTables\cr
27 | Type: \tab Package\cr
28 | Version: \tab 3.0.0\cr
29 | Date: \tab 2023-06-29\cr
30 | License: \tab MIT\cr
31 | }
32 | }
33 | \author{
34 | \tabular{ll}{
35 | Author: \tab David J. Stanley \email{dstanley@uoguelph.ca}\cr
36 | Maintainer: \tab David J. Stanley \email{dstanley@uoguelph.ca}
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/man/dating_wide.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-dating_wide.R
3 | \docType{data}
4 | \name{dating_wide}
5 | \alias{dating_wide}
6 | \title{dating data from textbook}
7 | \format{
8 | A data frame with 20 rows and 11 columns. Gender is a between subjects variable. Looks and Personality are within subject variables. Both gender and particpant are factors.
9 | \describe{
10 | \item{participant}{Factor: Participant ID number}
11 | \item{gender}{Factor: Gender: Male/Female}
12 | \item{attractive_high}{Date rating where looks=attractive and personality=high}
13 | \item{average_high}{Date rating where looks=average and personality=high}
14 | \item{ugly_high}{Date rating where looks=ugly and personality=high}
15 | \item{attractive_some}{Date rating where looks=attractive and personality=some}
16 | \item{average_some}{Date rating where looks=average and personality=some}
17 | \item{ugly_some}{Date rating where looks=ugly and personality=some}
18 | \item{attractive_none}{Date rating where looks=attractive and personality=none}
19 | \item{average_none}{Date rating where looks=average and personality=none}
20 | \item{ugly_none}{Date rating where looks=ugly and personality=none}
21 | }
22 | }
23 | \source{
24 | \url{https://studysites.sagepub.com/dsur/study/}
25 | }
26 | \usage{
27 | data(dating_wide)
28 | }
29 | \description{
30 | A data set from Field et al (2012)
31 | }
32 | \references{
33 | Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
34 | }
35 | \keyword{datasets}
36 |
--------------------------------------------------------------------------------
/man/drink_attitude_wide.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-drink_attitude_wide.R
3 | \docType{data}
4 | \name{drink_attitude_wide}
5 | \alias{drink_attitude_wide}
6 | \title{drink attitude data from textbook}
7 | \format{
8 | A data frame with 20 rows and 10 columns. Drink and Imagery are within subject variables. Particpant is a factor.
9 | \describe{
10 | \item{participant}{Factor: Participant ID number}
11 | \item{beer_positive}{Attitude where drink=beer and imagery=positive}
12 | \item{beer_negative}{Attitude where drink=beer and imagery=negative}
13 | \item{beer_neutral}{Attitude where drink=beer and imagery=neutral}
14 | \item{wine_positive}{Attitude where drink=wine and imagery=positive}
15 | \item{wine_negative}{Attitude where drink=wine and imagery=negative}
16 | \item{wine_neutral}{Attitude where drink=wine and imagery=neutral}
17 | \item{water_positive}{Attitude where drink=water and imagery=positive}
18 | \item{water_negative}{Attitude where drink=water and imagery=negative}
19 | \item{water_neutral}{Attitude where drink=water and imagery=neutral}
20 | }
21 | }
22 | \source{
23 | \url{https://studysites.sagepub.com/dsur/study/}
24 | }
25 | \usage{
26 | data(drink_attitude_wide)
27 | }
28 | \description{
29 | A data set from Field et al (2012)
30 | }
31 | \references{
32 | Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
33 | }
34 | \keyword{datasets}
35 |
--------------------------------------------------------------------------------
/man/fidler_thompson.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-fidler_thompson.R
3 | \docType{data}
4 | \name{fidler_thompson}
5 | \alias{fidler_thompson}
6 | \title{Fidler & Thompson (2001) Fixed-Effects ANOVA data}
7 | \format{
8 | A data frame with 24 rows and 3 variables:
9 | \describe{
10 | \item{a}{Independent variable: a}
11 | \item{b}{Independent variable: b}
12 | \item{dv}{Dependent variable: dv}
13 | }
14 | }
15 | \usage{
16 | data(fidler_thompson)
17 | }
18 | \description{
19 | A data set from Fidler & Thompson (2001)
20 | }
21 | \references{
22 | Fidler, F. & Thompson, B. (2001). Computing correct confidence intervals for ANOVA fixed- and random-effects effect sizes. Educational and Psychological Measurement, 61, 575-604.
23 | }
24 | \keyword{datasets}
25 |
--------------------------------------------------------------------------------
/man/get.ci.partial.eta.squared.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/etaSquaredCI.R
3 | \name{get.ci.partial.eta.squared}
4 | \alias{get.ci.partial.eta.squared}
5 | \title{Calculates confidence interval for partial eta-squared in a fixed-effects ANOVA}
6 | \usage{
7 | get.ci.partial.eta.squared(F.value, df1, df2, conf.level = 0.9)
8 | }
9 | \arguments{
10 | \item{F.value}{The F-value for the fixed-effect}
11 |
12 | \item{df1}{Degrees of freedom for the fixed-effect}
13 |
14 | \item{df2}{Degrees of freedom error}
15 |
16 | \item{conf.level}{Confidence level (0 to 1). For partial eta-squared a confidence level of .90 is traditionally used rather than .95.}
17 | }
18 | \value{
19 | List with confidence interval values (LL and UL)
20 | }
21 | \description{
22 | Calculates confidence interval for partial eta-squared in a fixed-effects ANOVA
23 | }
24 | \examples{
25 | # Smithson (2001) p. 619
26 | get.ci.partial.eta.squared(F.value=6.00, df1=1, df2=42, conf.level=.90)
27 | get.ci.partial.eta.squared(F.value=2.65, df1=6, df2=42, conf.level=.90)
28 | get.ci.partial.eta.squared(F.value=2.60, df1=6, df2=42, conf.level=.90)
29 |
30 | # Fidler & Thompson (2001) Fixed Effects 2x4 p. 594 (Table 6) / p. 596 (Table 8)
31 | get.ci.partial.eta.squared(F.value=1.50, df1=1, df2=16, conf.level=.90)
32 | get.ci.partial.eta.squared(F.value=4.00, df1=3, df2=16, conf.level=.90)
33 | get.ci.partial.eta.squared(F.value=1.50, df1=3, df2=16, conf.level=.90)
34 | }
35 |
--------------------------------------------------------------------------------
/man/goggles.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-goggles.R
3 | \docType{data}
4 | \name{goggles}
5 | \alias{goggles}
6 | \title{goggles data from textbook}
7 | \format{
8 | A data frame with 48 rows and 3 variables:
9 | \describe{
10 | \item{participant}{Participant identification number}
11 | \item{gender}{Gender of participant}
12 | \item{alcohol}{Amount alcohol consumed }
13 | \item{attractiveness}{Perceived attractiveness}
14 | }
15 | }
16 | \source{
17 | \url{https://studysites.sagepub.com/dsur/study/}
18 | }
19 | \usage{
20 | data(goggles)
21 | }
22 | \description{
23 | A data set from Field et al (2012)
24 | }
25 | \references{
26 | Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
27 | }
28 | \keyword{datasets}
29 |
--------------------------------------------------------------------------------
/man/viagra.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data-viagra.R
3 | \docType{data}
4 | \name{viagra}
5 | \alias{viagra}
6 | \title{viagra data from textbook}
7 | \format{
8 | A data frame with 15 rows and 2 variables:
9 | \describe{
10 | \item{dose}{Level of viagra dose}
11 | \item{libido}{Libido after taking viagra}
12 | }
13 | }
14 | \source{
15 | \url{https://studysites.sagepub.com/dsur/study/}
16 | }
17 | \usage{
18 | data(viagra)
19 | }
20 | \description{
21 | A data set from Field et al (2012)
22 | }
23 | \references{
24 | Field, A., Miles, J., & Field, Z. (2012) Discovering Statistics Using R. Sage: Chicago.
25 | }
26 | \keyword{datasets}
27 |
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(apaTables)
3 |
4 | test_check("apaTables")
5 |
--------------------------------------------------------------------------------
/tests/testthat/test_anova_ci.R:
--------------------------------------------------------------------------------
1 | library(apaTables)
2 | context("Smithson (2001) partial eta squared CI")
3 | test_that("get.ci.partial.eta.squared is correct ci: Smithson (2001)", {
4 | #main effect a
5 | expect_equal(round(get.ci.partial.eta.squared(F.value=6, df1=1, df2=42, conf.level=.90)$LL,4),.0117)
6 | expect_equal(round(get.ci.partial.eta.squared(F.value=6, df1=1, df2=42, conf.level=.90)$UL,4),.2801)
7 |
8 | #main effect b
9 | expect_equal(round(get.ci.partial.eta.squared(F.value=2.65, df1=6, df2=42, conf.level=.90)$LL,4),.0174)
10 | expect_equal(round(get.ci.partial.eta.squared(F.value=2.65, df1=6, df2=42, conf.level=.90)$UL,4),.3577)
11 |
12 | #interaction ab
13 | expect_equal(round(get.ci.partial.eta.squared(F.value=2.50, df1=6, df2=42, conf.level=.90)$LL,3),.009)
14 | expect_equal(round(get.ci.partial.eta.squared(F.value=2.50, df1=6, df2=42, conf.level=.90)$UL,4),.3455)
15 |
16 | })
17 |
18 |
19 | context("Fidler & Thompson (2001) partial eta squared CI")
20 | test_that("get.ci.partial.eta.squared is correct ci: Smithson (2001)", {
21 | #main effect a
22 | expect_equal(round(get.ci.partial.eta.squared(F.value=1.5, df1=1, df2=16, conf.level=.90)$LL,4),0)
23 | expect_equal(round(get.ci.partial.eta.squared(F.value=1.5, df1=1, df2=16, conf.level=.90)$UL,4),.3167)
24 |
25 | #main effect b
26 | expect_equal(round(get.ci.partial.eta.squared(F.value=4.00, df1=3, df2=16, conf.level=.90)$LL,4),.0357)
27 | expect_equal(round(get.ci.partial.eta.squared(F.value=4.00, df1=3, df2=16, conf.level=.90)$UL,4),.5671)
28 |
29 | #interaction ab
30 | expect_equal(round(get.ci.partial.eta.squared(F.value=1.5, df1=3, df2=16, conf.level=.90)$LL,4),0)
31 | expect_equal(round(get.ci.partial.eta.squared(F.value=1.5, df1=3, df2=16, conf.level=.90)$UL,4),.3778)
32 |
33 | })
34 |
--------------------------------------------------------------------------------
/tests/testthat/test_beta.R:
--------------------------------------------------------------------------------
1 | library(apaTables)
2 | context("beta value calculation")
3 | test_that("Test values in Field et al Regression Chapter", {
4 | expect_equal(reg_test1(),0.5108462)
5 | })
6 |
--------------------------------------------------------------------------------
/tests/testthat/test_d_calc.R:
--------------------------------------------------------------------------------
1 | library(apaTables)
2 | context("d value calculation")
3 | test_that("Test positive negative d-values", {
4 | expect_equal(round(d_value_test1(),7),0.9434933)
5 | expect_equal(round(d_value_test2(),7),0.9434933)
6 | })
7 |
--------------------------------------------------------------------------------
/tests/testthat/test_deltaR2_ci.R:
--------------------------------------------------------------------------------
1 | library(apaTables)
2 | context("Delta R2 CI")
3 | test_that("Test example Alf & Graf (1999) p. 73", {
4 | expect_equal(round(get_deltaR2_ci(R2_2=.45^2,R2_1=.433^2,n=1415,conf_level=.95)$LL,4),.0037)
5 | expect_equal(round(get_deltaR2_ci(R2_2=.45^2,R2_1=.433^2,n=1415,conf_level=.95)$UL,4),.0263)
6 | expect_equal(round(get_deltaR2_ci(R2_2=.45^2,R2_1=.433^2,n=1415,conf_level=.90)$LL,4),.0055)
7 | expect_equal(round(get_deltaR2_ci(R2_2=.45^2,R2_1=.433^2,n=1415,conf_level=.90)$UL,4),.0245)
8 |
9 | })
10 |
--------------------------------------------------------------------------------
/tests/testthat/test_r_ci.R:
--------------------------------------------------------------------------------
1 | library(apaTables)
2 | context("r calculation")
3 | test_that("Test r calculation and CI", {
4 | expect_equal(cor_test1()$r,".83**")
5 | expect_equal(cor_test1()$CI,"[.66, .91]")
6 | expect_equal(cor_test1()$m,"64.63")
7 | expect_equal(cor_test1()$sd,"12.17")
8 | })
9 |
--------------------------------------------------------------------------------
/vignettes/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 | *.R
3 |
--------------------------------------------------------------------------------
/vignettes/articles/Table1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table1.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table10.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table11.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table2.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table3.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table4.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table5.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table6.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table7.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table8.jpg
--------------------------------------------------------------------------------
/vignettes/articles/Table9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dstanley4/apaTables/bd45cfd51891138e805f0fc169c0978c4c6cdfce/vignettes/articles/Table9.jpg
--------------------------------------------------------------------------------