This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_table <- data.frame(t(apply(cars, 2, function(x) # Create data | |
round(c(Mean = mean(x), SD = sd(x), Min = min(x), Max = max(x)), 2) | |
))) | |
variable_labels(my_table) <- c("Mean" = "$\\textit{Mean}$", "SD" = "$\\textit{SD}$") | |
apa_table( | |
my_table | |
, align = c("l", rep("r", 3)) | |
, caption = "A summary table of the cars dataset." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" page-range-format="expanded"> | |
<!-- This style was edited with the Visual CSL Editor (http://editor.citationstyles.org/visualEditor/) --> | |
<info> | |
<title>American Psychological Association 6th edition</title> | |
<title-short>APA</title-short> | |
<id>http://www.zotero.org/styles/american-psychological-association-6th-edition</id> | |
<link href="http://www.zotero.org/styles/american-psychological-association-6th-edition" rel="self"/> | |
<link href="http://owl.english.purdue.edu/owl/resource/560/01/" rel="documentation"/> | |
<author> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never"> | |
<!-- This style was edited with the Visual CSL Editor (http://editor.citationstyles.org/visualEditor/) --> | |
<info> | |
<title>American Psychological Association 6th edition (no disambiguation)</title> | |
<title-short>APA</title-short> | |
<id>http://www.zotero.org/styles/apa</id> | |
<link href="http://www.zotero.org/styles/apa" rel="self"/> | |
<link href="http://owl.english.purdue.edu/owl/resource/560/01/" rel="documentation"/> | |
<author> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
batch_download_github <- function(url, pattern, path, ...) { | |
if(!require("rvest")) stop("Please install the 'rvest' package.") | |
if(!require("RCurl")) stop("Please install the 'RCurl' package.") | |
# Fetch file names | |
github_page <- read_html(url) | |
file_nodes <- html_nodes(github_page, ".content .css-truncate-target .js-navigation-open") | |
file_names <- html_text(file_nodes) | |
file_url <- html_attr(file_nodes, "href")[grep(pattern, file_names)] | |
file_names <- file_names[grep(pattern, file_names)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title : "The title" | |
shorttitle : "Title" | |
author: | |
- name : "First Author" | |
affiliation : "1" | |
corresponding : yes # Define only one corresponding author | |
address : "Postal address" | |
email : "[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The ID of a Zotero user or group can be found via Zotero.org. E.g. the public group "PSYCH 490 ARTICLES" | |
# can be found at https://www.zotero.org/groups/1738107/psych_490_articles/items. The URL contains the group ID 1738107. | |
# To access the group via the Zotero API you need an account and an API key. API keys can be created and accessed | |
# at https://www.zotero.org/settings/keys when you are logged into your user account. | |
# | |
# As of the current development version fetch_zotero_refs() has not been exported (to be honest, I don't know why). | |
# Hence, the papaja:::-prefix is required. | |
papaja:::fetch_zotero_refs( | |
x = "1738107" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
references: | |
- id: fmla2006 | |
title: "Family and Medical Leave Act of 1993" | |
container-title: "29 U.S.C" | |
page: "§§261-263" | |
type: "legislation" | |
issued: | |
year: 2006 | |
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minimizeError <- function(x, max_error, multicore = TRUE) { | |
while(any(x@bayesFactor$error > max_error)) { | |
message("Current error: ", x@bayesFactor$error) | |
x <- recompute(x, multicore = multicore) | |
} | |
x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stolen from http://stackoverflow.com/a/12041779/914024 | |
gglegend <- function(x){ | |
tmp <- ggplot_gtable(ggplot_build(x)) | |
leg <- which(sapply(tmp$grobs, function(y) y$name) == "guide-box") | |
tmp$grobs[[leg]] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean_difference_r <- function(x, object) UseMethod("mean_difference_r", object) | |
mean_difference_r.lm <- function(x, object) { | |
x * sigma(object) | |
} | |
mean_difference_r.mlm <- function(x, object) { | |
x * sqrt(mean(sigma(object)^2)) | |
} |
NewerOlder