Skip to content

Commit 9572de8

Browse files
committedSep 20, 2016
Preparing CRAN submission.
1 parent e91ad29 commit 9572de8

File tree

16 files changed

+116
-64
lines changed

16 files changed

+116
-64
lines changed
 

‎.Rbuildignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
^.travis.yml
55
^cran-comments.md
6-
^README.Rmd
6+
^README.Rmd
7+
^README_files$

‎DESCRIPTION

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
Package: prereg
22
Type: Package
3-
Title: R Markdown Template to Preregister Scientific Studies
4-
Version: 0.1.0.9002
5-
Date: 2016-2-15
3+
Title: R Markdown Templates to Preregister Scientific Studies
4+
Version: 0.2.0
5+
Date: 2016-9-20
66
Authors@R: c(person("Frederik", "Aust", email = "frederik.aust@uni-koeln.de", role = c("aut", "cre")))
77
Description: The R Markdown templates in this package are based on the Center
8-
for Open Science Preregistration Challenge and the AsPredicted.org questions.
8+
for Open Science Preregistration Challenge and the 'AsPredicted.org' questions.
99
They are, thus, particularly suited to draft preregistration documents for
10-
studies these programs but can also be used for internal preregistrations.
10+
these programs but can also be used for internally.
1111
URL: https://github.com/crsh/prereg
1212
BugReports: https://github.com/crsh/prereg/issues
1313
Depends:
14-
R (>= 3.2.3)
14+
R (>= 3.0.0)
1515
Imports:
16-
rmarkdown (>= 0.9.2)
16+
rmarkdown (>= 1.0)
1717
Suggests:
1818
testthat
1919
License: GPL-3

‎NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# prereg 0.2.0
2+
3+
- New template based on AsPredicted.org questions. See `?aspredicted_prereg`.
4+
15
# prereg 0.1.0
26

37
Initial release.

‎R/aspredicted_prereg.R

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' AsPredicted.org template
22
#'
3-
#' Knit a PDF document using the AsPredicted.org template
3+
#' Knit a PDF document using the AsPredicted.org questions
44
#'
55
#' @param ... additional arguments to \code{\link[rmarkdown]{pdf_document}}; \code{template} is ignored.
66
#' @examples
@@ -23,33 +23,33 @@
2323
aspredicted_prereg <- function(...) {
2424
ellipsis <- list(...)
2525
if(!is.null(ellipsis$template)) ellipsis$template <- NULL
26-
26+
2727
# Get cos_prereg template
2828
template <- system.file(
2929
"rmarkdown", "templates", "aspredicted_prereg", "resources"
3030
, "aspredicted_prereg.tex"
3131
, package = "prereg"
3232
)
3333
if(template == "") stop("No LaTeX template file found.") else ellipsis$template <- template
34-
34+
3535
# Create format
3636
aspredicted_prereg_format <- do.call(rmarkdown::pdf_document, ellipsis)
37-
37+
3838
## Overwrite preprocessor to set correct margin and CSL defaults
3939
saved_files_dir <- NULL
40-
40+
4141
# Preprocessor functions are adaptations from the RMarkdown package
4242
# (https://github.com/rstudio/rmarkdown/blob/master/R/pdf_document.R)
4343
# to ensure right geometry defaults in the absence of user specified values
4444
pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir, output_dir) {
4545
# save files dir (for generating intermediates)
4646
saved_files_dir <<- files_dir
47-
47+
4848
aspredicted_pdf_pre_processor(metadata, input_file, runtime, knit_meta, files_dir, output_dir)
4949
}
50-
50+
5151
aspredicted_prereg_format$pre_processor <- pre_processor
52-
52+
5353
aspredicted_prereg_format
5454
}
5555

@@ -59,7 +59,7 @@ aspredicted_prereg <- function(...) {
5959

6060
aspredicted_pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir, output_dir) {
6161
args <- c()
62-
62+
6363
# Set margins if no other geometry options specified
6464
has_geometry <- function(text) {
6565
length(grep("^geometry:.*$", text)) > 0
@@ -71,7 +71,7 @@ aspredicted_pdf_pre_processor <- function(metadata, input_file, runtime, knit_me
7171
, "--variable", "geometry:top=1.25in"
7272
, "--variable", "geometry:right=1in"
7373
)
74-
74+
7575
# Use APA6 CSL citations template if no other file is supplied
7676
has_csl <- function(text) {
7777
length(grep("^csl:.*$", text)) > 0
@@ -84,6 +84,6 @@ aspredicted_pdf_pre_processor <- function(metadata, input_file, runtime, knit_me
8484
if(csl_template == "") stop("No CSL template file found.")
8585
args <- c(args, c("--csl", rmarkdown::pandoc_path_arg(csl_template)))
8686
}
87-
87+
8888
args
8989
}

‎R/cos_prereg.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' COS Preregistration Challenge template
22
#'
3-
#' Knit a PDF document using the COS Preregistration Challenge template
3+
#' Knit a PDF document using the COS Preregistration Challenge questions
44
#'
55
#' @param ... additional arguments to \code{\link[rmarkdown]{pdf_document}}; \code{template} is ignored.
66
#' @examples
@@ -60,7 +60,7 @@ cos_prereg <- function(...) {
6060

6161
cos_pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, files_dir, output_dir) {
6262
args <- c()
63-
63+
6464
# Set margins if no other geometry options specified
6565
has_geometry <- function(text) {
6666
length(grep("^geometry:.*$", text)) > 0
@@ -72,7 +72,7 @@ cos_pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, file
7272
, "--variable", "geometry:top=1.25in"
7373
, "--variable", "geometry:right=1in"
7474
)
75-
75+
7676
# Use APA6 CSL citations template if no other file is supplied
7777
has_csl <- function(text) {
7878
length(grep("^csl:.*$", text)) > 0
@@ -85,6 +85,6 @@ cos_pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, file
8585
if(csl_template == "") stop("No CSL template file found.")
8686
args <- c(args, c("--csl", rmarkdown::pandoc_path_arg(csl_template)))
8787
}
88-
88+
8989
args
9090
}

‎R/prereg.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#' R Markdown Template for Preregistrations of Scientific Studies
1+
#' R Markdown Templates to Preregister Scientific Studies
22
#'
3-
#' The \href{http://rmarkdown.rstudio.com/}{R Markdown} template in the prereg package is based
3+
#' The provided \href{http://rmarkdown.rstudio.com/}{R Markdown} templates are based
44
#' on the \href{https://cos.io/prereg/}{Center for Open Science Preregistration Challenge} and
5-
#' is, thus, particularly suited to draft preregistrations that enter the challenge.
5+
#' the \href{https://aspredicted.org/}{AsPredicted.org} questions. They are, thus, particularly
6+
#' suited to draft preregistration documents for these programs but can also be used for internal
7+
#' preregistrations.
8+
#'
69
#' @section System requirements:
710
#' Before using \pkg{prereg} to create a preregistration document, make sure the following
811
#' software is installed on your computer:

‎README.Rmd

+22-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: "prereg: R Markdown Templates for Preregistrations of Scientific Studies"
33
output: github_document
44
---
55

6-
[![CRAN status](http://www.r-pkg.org/badges/version/prereg)](https://cran.r-project.org/web/packages/prereg/index.html)
7-
[![Download counter](http://cranlogs.r-pkg.org/badges/prereg)](https://cran.r-project.org/web/packages/prereg/index.html)
6+
[![CRAN status](http://www.r-pkg.org/badges/version/prereg)](https://cran.r-project.org/package=prereg)
7+
[![Download counter](http://cranlogs.r-pkg.org/badges/prereg)](https://cran.r-project.org/package=prereg)
88
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
99
[![Build status](https://travis-ci.org/crsh/prereg.svg?branch=master)](https://travis-ci.org/crsh/prereg)
1010

1111
`prereg` provides [R Markdown](http://rmarkdown.rstudio.com/) templates that facilitates authoring preregistrations of scientific studies in PDF format.
12-
The templates are based on the [Center for Open Science Preregistration Challenge](https://cos.io/prereg/) template and the [AsPredicted.org](http://aspredicted.org) questions.
12+
The templates are based on the [Center for Open Science Preregistration Challenge](https://cos.io/prereg/) and the [AsPredicted.org](http://aspredicted.org) questions.
1313
They are, thus, particularly suited to draft preregistration documents for studies these programs but can also be used for internal preregistrations.
1414

1515
If you experience any problems or have suggestions for improvements, please [open an issue](https://github.com/crsh/prereg/issues).
@@ -57,9 +57,27 @@ The template file contains comments that provide further details on how to fill
5757
If you want to use `prereg` without RStudio you can use the `rmarkdown::render` function to create preregistration documents:
5858

5959
```S
60-
rmarkdown::render("mymanuscript.Rmd")
60+
# Create new COS preregistration challenge R Markdown file
61+
rmarkdown::draft(
62+
"my_preregistration.Rmd"
63+
, "cos_prereg"
64+
, package = "prereg"
65+
, create_dir = FALSE
66+
, edit = FALSE
67+
)
68+
69+
# Render document
70+
rmarkdown::render("my_preregistration.Rmd")
6171
```
6272

6373
## Acknowledgements
6474
The templates for the preregistrations were developed by the [Center for Open Science](https://cos.io/prereg/) and [AsPredicted.org](http://aspredicted.org), respectively.
6575
I thank both for their permission to use their material in this package.
76+
77+
## Package dependencies
78+
79+
```{r echo = FALSE, message = FALSE}
80+
source("https://gist.githubusercontent.com/crsh/c906e93c260488e7363ea606243057c2/raw/5243c091d5809cb71473c4ef3f926065e9e2532d/plot_dependencies.R")
81+
82+
plot_dependencies()
83+
```

‎README.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
prereg: R Markdown Templates for Preregistrations of Scientific Studies
22
================
33

4-
[![CRAN status](http://www.r-pkg.org/badges/version/prereg)](https://cran.r-project.org/web/packages/prereg/index.html) [![Download counter](http://cranlogs.r-pkg.org/badges/prereg)](https://cran.r-project.org/web/packages/prereg/index.html) [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![Build status](https://travis-ci.org/crsh/prereg.svg?branch=master)](https://travis-ci.org/crsh/prereg)
4+
[![CRAN status](http://www.r-pkg.org/badges/version/prereg)](https://cran.r-project.org/package=prereg) [![Download counter](http://cranlogs.r-pkg.org/badges/prereg)](https://cran.r-project.org/package=prereg) [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![Build status](https://travis-ci.org/crsh/prereg.svg?branch=master)](https://travis-ci.org/crsh/prereg)
55

6-
`prereg` provides [R Markdown](http://rmarkdown.rstudio.com/) templates that facilitates authoring preregistrations of scientific studies in PDF format. The templates are based on the [Center for Open Science Preregistration Challenge](https://cos.io/prereg/) template and the [AsPredicted.org](http://aspredicted.org) questions. They are, thus, particularly suited to draft preregistration documents for studies these programs but can also be used for internal preregistrations.
6+
`prereg` provides [R Markdown](http://rmarkdown.rstudio.com/) templates that facilitates authoring preregistrations of scientific studies in PDF format. The templates are based on the [Center for Open Science Preregistration Challenge](https://cos.io/prereg/) and the [AsPredicted.org](http://aspredicted.org) questions. They are, thus, particularly suited to draft preregistration documents for studies these programs but can also be used for internal preregistrations.
77

88
If you experience any problems or have suggestions for improvements, please [open an issue](https://github.com/crsh/prereg/issues).
99

@@ -55,10 +55,25 @@ The template file contains comments that provide further details on how to fill
5555
If you want to use `prereg` without RStudio you can use the `rmarkdown::render` function to create preregistration documents:
5656

5757
``` s
58-
rmarkdown::render("mymanuscript.Rmd")
58+
# Create new COS preregistration challenge R Markdown file
59+
rmarkdown::draft(
60+
"my_preregistration.Rmd"
61+
, "cos_prereg"
62+
, package = "prereg"
63+
, create_dir = FALSE
64+
, edit = FALSE
65+
)
66+
67+
# Render document
68+
rmarkdown::render("my_preregistration.Rmd")
5969
```
6070

6171
Acknowledgements
6272
----------------
6373

6474
The templates for the preregistrations were developed by the [Center for Open Science](https://cos.io/prereg/) and [AsPredicted.org](http://aspredicted.org), respectively. I thank both for their permission to use their material in this package.
75+
76+
Package dependencies
77+
--------------------
78+
79+
![](README_files/figure-markdown_github/unnamed-chunk-1-1.png)
Loading

‎cran-comments.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
## Test environments
2-
* local OS X 10.11 install, R 3.2.3
3-
* local Ubuntu 14.04 install, R 3.2.3
4-
* Ubuntu 12.04 (on travis-ci), R 3.2.3
1+
# Test environments
2+
3+
* local OS X 10.11 install, R 3.3.1
4+
* local Ubuntu 14.04 install, R 3.3.1
5+
* Ubuntu 12.04 (old release, release, and devel; on travis-ci)
56
* win-builder (devel and release)
67

7-
## R CMD check results
8-
There were no ERRORs, WARNINGs or NOTEs.
8+
# R CMD check results
9+
10+
There were no ERRORs or WARNINGs but one NOTE:
11+
12+
* Found the following (possibly) invalid URLs:
13+
URL: http://cos.io/prereg/
14+
From: README.md
15+
Status: Error
16+
Message: libcurl error code 35
17+
Unknown SSL protocol error in connection to cos.io:443
18+
URL: https://cos.io/prereg/
19+
From: man/prereg.Rd
20+
Status: Error
21+
Message: libcurl error code 35
22+
Unknown SSL protocol error in connection to cos.io:443
23+
24+
The URL is correct and the web page displays correctly in a web browser.
25+
26+
# Downstream dependencies
927

10-
## Downstream dependencies
11-
There are no downstream dependencies.
28+
There are no downstream dependencies.

‎inst/rmarkdown/templates/aspredicted_prereg/skeleton/skeleton.Rmd

-8
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ output: prereg::aspredicted_prereg
7373
> Example: We will include a battery of questions for exploratory purposes, including life satisfaction, amount of videogame playing, and family activity. We will also provide an additional survey with 24 questions assessing achievement orientation.We will not report the results of those analyses for the project being pre-registered.
7474
7575

76-
## Name
77-
<!-- Give a title for this AsPredicted pre-registration. Suggestion: use the name of the project, followed by study description. -->
78-
79-
> Example: SUMMER PROGRAMS - GPA performance, Chicago, July 2016
80-
81-
`r rmarkdown::metadata$title`
82-
83-
8476
# References
8577
##
8678
\vspace{-2pc}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: COS Preregistration Challenge
22
description: >
3-
This template is based on the Center for Open Science Preregistration Challenge template and is, thus, particularly suited to draft preregistrations that enter the challenge.
3+
This template is based on the Center for Open Science Preregistration Challenge questions and is, thus, particularly suited to draft preregistrations that enter the challenge.
44
create_dir: false

‎man/aspredicted_prereg.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/cos_prereg.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/prereg.Rd

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/testthat/test_skeletons.R

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@ test_that(
22
"Knit COS skeleton"
33
, {
44
skip_on_cran()
5-
5+
66
# Render skeleton
77
rmarkdown::draft(
8-
"bare_skeleton.Rmd"
8+
"cos_skeleton.Rmd"
99
, "cos_prereg"
1010
, package = "prereg"
1111
, create_dir = FALSE
1212
, edit = FALSE
1313
)
14-
rmarkdown::render("bare_skeleton.Rmd")
14+
rmarkdown::render("cos_skeleton.Rmd")
1515

1616
# Clean up
17-
file.remove(list.files(pattern = "bare"))
17+
file.remove(list.files(pattern = "cos"))
1818
}
1919
)
2020

2121
test_that(
2222
"Knit AsPredicted skeleton"
2323
, {
2424
skip_on_cran()
25-
25+
2626
# Render skeleton
2727
rmarkdown::draft(
28-
"bare_skeleton.Rmd"
28+
"aspredicted_skeleton.Rmd"
2929
, "aspredicted_prereg"
3030
, package = "prereg"
3131
, create_dir = FALSE
3232
, edit = FALSE
3333
)
34-
rmarkdown::render("bare_skeleton.Rmd")
35-
34+
rmarkdown::render("aspredicted_skeleton.Rmd")
35+
3636
# Clean up
37-
file.remove(list.files(pattern = "bare"))
37+
file.remove(list.files(pattern = "aspredicted"))
3838
}
3939
)

0 commit comments

Comments
 (0)
Please sign in to comment.