-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from psysciacc/check-folder
Check folder
- Loading branch information
Showing
45 changed files
with
661 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
here,is,a,lab,notebook |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# setup | ||
tdir <- file.path(tempdir(), "PSA") | ||
if (dir.exists(tdir)) unlink(tdir, recursive = TRUE) | ||
dir.create(tdir, showWarnings = FALSE) | ||
|
||
|
||
# Create model folder to check on | ||
test_path <- system.file("tests", "testthat", package = "psaverse") | ||
file.copy(test_path, tdir, recursive = TRUE) | ||
test_pkg <- file.path(tdir, "testthat", "testCheckFolder") | ||
|
||
# Activate dummy package to use the function on it | ||
usethis::proj_activate(test_pkg) | ||
|
||
test_that("ethics", { | ||
expect_no_error(psa_check_folder(folder = "ethics")) | ||
}) | ||
|
||
test_that("power", { | ||
expect_no_error(psa_check_folder(folder = "power")) | ||
}) | ||
|
||
test_that("materials", { | ||
expect_no_error(psa_check_folder(folder = "materials")) | ||
}) | ||
|
||
test_that("procedure", { | ||
expect_no_error(psa_check_folder(folder = "procedure")) | ||
}) | ||
|
||
test_that("data", { | ||
expect_no_error(psa_check_folder(folder = "data")) | ||
}) | ||
|
||
test_that("analysis", { | ||
expect_no_error(psa_check_folder(folder = "analysis")) | ||
}) | ||
|
||
test_that("communication", { | ||
expect_no_error(psa_check_folder(folder = "communication")) | ||
}) | ||
|
||
test_that("other", { | ||
expect_no_error(psa_check_folder(folder = "other")) | ||
}) | ||
|
||
test_that("all", { | ||
expect_no_error(psa_check_folder(folder = "all")) | ||
}) | ||
|
||
# clean up | ||
unlink(tdir, recursive = TRUE) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Package: testCheckFolder | ||
Type: Package | ||
Title: What the Package Does (Title Case) | ||
Version: 0.1.0 | ||
Author: Who wrote it | ||
Maintainer: The package maintainer <[email protected]> | ||
Description: More about what it does (maybe more than one line) | ||
Use four spaces when indenting paragraphs within the Description. | ||
License: What license is it under? | ||
Encoding: UTF-8 | ||
LazyData: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exportPattern("^[[:alpha:]]+") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Hello, world! | ||
# | ||
# This is an example function named 'hello' | ||
# which prints 'Hello, world!'. | ||
# | ||
# You can learn more about package authoring with RStudio at: | ||
# | ||
# https://r-pkgs.org | ||
# | ||
# Some useful keyboard shortcuts for package authoring: | ||
# | ||
# Install Package: 'Ctrl + Shift + B' | ||
# Check Package: 'Ctrl + Shift + E' | ||
# Test Package: 'Ctrl + Shift + T' | ||
|
||
hello <- function() { | ||
print("Hello, world!") | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test |
Empty file.
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/01_Ethics/lab_ethics_summary.csv
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Some sort of power analysis should exist. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/02_Power/power-analysis.Rmd
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Some sort of power analysis should exist. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/03_Materials/Text/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/03_Materials/Translation/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/04_Procedure/English/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/04_Procedure/Translation/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/04_Procedure/Video/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/04_Procedure/lab_notebook.csv
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
here,is,a,lab,notebook |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/05_Data/Processed Data/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/05_Data/Raw Data/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/05_Data/Scripts/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/06_Analysis/Images/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/06_Analysis/Includes/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/06_Analysis/Outputs/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/06_Analysis/Supplemental/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/07_Communication/Manuscript/tenzing.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/07_Communication/Pre-Registration/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
1 change: 1 addition & 0 deletions
1
tests/testthat/testCheckFolder/inst/07_Communication/Presentations/stimuli.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A file here to ensure the folder syncs to github. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A readme file should exist in this folder. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
\name{hello} | ||
\alias{hello} | ||
\title{Hello, World!} | ||
\usage{ | ||
hello() | ||
} | ||
\description{ | ||
Prints 'Hello, world!'. | ||
} | ||
\examples{ | ||
hello() | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,18 +35,73 @@ You can update the description of the package using the `psa_update_description( | |
|
||
```{r eval = F} | ||
psa_update_description( | ||
package_title = NULL, | ||
package_title = "SPAML IS GREAT", | ||
description = NULL, | ||
version = NULL, | ||
license = NULL | ||
) | ||
# make sure default to null | ||
# make sure this updates on the current project | ||
# seems to update the original folder | ||
# function to make sure you are in the right project | ||
# make sure we aren't reloading each time | ||
``` | ||
|
||
You can add authors to the package for other project monitors or the lead author of the paper. | ||
|
||
```{r eval = F} | ||
psa_add_author( | ||
given = "Lucy", | ||
family = "van Pelt", | ||
role = c("aut", "cre"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "LUCY-ORCID-ID")) | ||
# why isn't comment working | ||
``` | ||
|
||
## Create Folder Structure | ||
|
||
`psa_create_folder("all")` will create the entire folder structure for the package, while you can also add one at a time. | ||
|
||
Other options: | ||
|
||
- "ethics": creates the "01_Ethics" folder. | ||
- "power": creates the "02_Power" folder. | ||
- "materials": creates the "03_Materials" folder. | ||
- "procedure": creates the "04_Procedure" folder. | ||
- "data": creates the "05_Data" folder. | ||
- "analysis": creates the "06_Analysis" folder. | ||
- "communication": creates the "07_Communication folder. | ||
- "all": creates all eight main folders. | ||
- Any other parameter option will be added into the 08_Other folder. | ||
|
||
```{r eval = F} | ||
# will create all folders | ||
psa_create_folder("all") | ||
# also allow people to use the "real" folder names like 01_Ethics | ||
psa_create_folder("cheese") | ||
``` | ||
|
||
## Add Dataset | ||
## Add Documents | ||
|
||
You can then manually move the files you need into the folder structure or use the `psa_add_documents()` function to add individual files or entire folders. | ||
|
||
```{r eval = F} | ||
psa_data( | ||
psa_add_documents( | ||
folder = "ethics", # where should it go | ||
path = "~/Downloads", # to a single file or directory | ||
should_replace = FALSE, # overwrite existing files? | ||
recursive = FALSE # better explain this in docs | ||
) | ||
# recheck copying individual files | ||
# path should allow vector of file paths like a list of PDFs | ||
# or a directory | ||
# or single file | ||
``` | ||
|
||
## Add R Package Dependencies | ||
|
@@ -58,9 +113,12 @@ psa_dependencies( | |
scan_folder = "inst", | ||
add_package = NULL # has to be one at a time | ||
) | ||
# add qmd files | ||
# allow for vector of packages to be added | ||
``` | ||
|
||
## Add R Package to PSA GitHub | ||
## Add this Package to PSA GitHub | ||
|
||
First, you should confirm you have the ability to push to the PsySciAcc github organization at https://github.com/psysciacc. Please ask to be added to the team. | ||
|
||
|
@@ -69,3 +127,27 @@ Second, you can use the `psa_git()` function to initialize your new project as a | |
```{r eval = F} | ||
psa_git() | ||
``` | ||
|
||
## Check Package Folders | ||
|
||
This function will check that you meet the minimum requires for documentation and files for the PSA folder structure. You will receive information on what you are missing. | ||
|
||
Options: "ethics", "power", "materials", "procedure", "data", "analysis", "communication", "all". | ||
|
||
```{r eval = F} | ||
psa_check_folder(folder = "ethics") | ||
# be sure to set working directory to the project so make it a global function | ||
``` | ||
|
||
working folder should not be empty if so make it "." | ||
|
||
can't write the testthat (or subfolders) for CRAN, so make sure it's writing to a temp directory | ||
(check scienceverse) | ||
|
||
https://scienceverse.github.io/scienceverse/index.html | ||
https://github.com/scienceverse/scienceverse/ | ||
|
||
https://github.com/debruine/booktem/blob/master/tests/testthat/test-create_book.R | ||
- preclean up | ||
- and then if stops be sure to clean up as well |