From 60004685258980a31a8122423624d6831807ebe3 Mon Sep 17 00:00:00 2001 From: Krieger Date: Sat, 24 Apr 2021 09:20:44 -0400 Subject: [PATCH] Code updates to remove warnings; updated templates --- DESCRIPTION | 5 ++- NEWS.md | 7 ++++ R/file_management.R | 6 ++-- R/metadata_manipulation.R | 12 +++---- R/setup.R | 4 +-- R/update.R | 2 +- README.md | 50 ++++++++++++++--------------- cran-comments.md | 5 +++ inst/templates/04_report.Rmd | 2 -- inst/templates/CONSORT_protocol.Rmd | 3 -- inst/templates/STROBE_protocol.Rmd | 3 -- 11 files changed, 51 insertions(+), 48 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 534a9fe..23ee02b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: projects Title: A Project Infrastructure for Researchers -Version: 2.1.2 +Version: 2.1.3 Authors@R: c(person(given = "Nik", family = "Krieger", @@ -40,8 +40,7 @@ Suggests: here (>= 0.1), testthat (>= 2.3.2) Encoding: UTF-8 -LazyData: true -RoxygenNote: 7.1.0 +RoxygenNote: 7.1.1 Collate: 'set_generics.R' 'class-projects_author.R' diff --git a/NEWS.md b/NEWS.md index 9057326..de810ed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,11 @@ +# projects 2.1.3 + +## Minor updates: +- Removed names from arguments passed to `readr::write_lines()` and `readr::write_rds()` since they have deprecated `path` in favor of `file`. +- Combined the `setup` and `load_libraries` code chunks in all applicable template .Rmd files. +- Removed `LazyData` line from `DESCRIPTION` file in compliance with new CRAN check. + # projects 2.1.2 ## Minor updates: diff --git a/R/file_management.R b/R/file_management.R index e6bb97a..f682803 100755 --- a/R/file_management.R +++ b/R/file_management.R @@ -465,7 +465,7 @@ archive_project <- function(project) { projects_table$path[projects_table$id == project_row$id] <- new_path - readr::write_rds(x = projects_table, path = projects_path) + readr::write_rds(projects_table, projects_path) print(dplyr::filter(projects_table, .data$id == project_row$id)) message("\nThe above project was archived and has the file path\n", new_path) @@ -640,7 +640,7 @@ move_projects_folder <- function(new_path, replacement = new_path ) - readr::write_rds(projects_table, path = projects_path) + readr::write_rds(projects_table, projects_path) message("\nProjects folder moved so that its new path is\n", new_path2) } @@ -699,7 +699,7 @@ rename_projects_folder <- function(new_name, replacement = new_path ) - readr::write_rds(projects_table, path = projects_path) + readr::write_rds(projects_table, projects_path) message("\nProjects folder renamed so that its new path is:\n", new_path) } diff --git a/R/metadata_manipulation.R b/R/metadata_manipulation.R index 76f3c0a..0d86f69 100755 --- a/R/metadata_manipulation.R +++ b/R/metadata_manipulation.R @@ -52,7 +52,7 @@ add_metadata <- function(table, new_row, table_path) { table <- vec_rbind(table, new_row) - readr::write_rds(x = table, path = table_path) + readr::write_rds(table, table_path) table[nrow(table), ] } @@ -73,7 +73,7 @@ edit_metadata <- function(table, row_id, ..., table_path) { } ) - readr::write_rds(x = table, path = table_path) + readr::write_rds(table, table_path) table[row_number, ] } @@ -84,7 +84,7 @@ delete_metadata <- function(table, row_id, table_path) { table <- table[table$id != row_id, ] - readr::write_rds(x = table, path = table_path) + readr::write_rds(table, table_path) } @@ -93,7 +93,7 @@ add_assoc <- function(assoc_table, new_rows, assoc_path) { assoc_table <- rbind(assoc_table, new_rows) - readr::write_rds(x = assoc_table, path = assoc_path) + readr::write_rds(assoc_table, assoc_path) assoc_table } @@ -109,7 +109,7 @@ delete_assoc <- function(assoc_table, ..., assoc_path) { dplyr::anti_join(assoc_table, assoc_to_delete) ) - readr::write_rds(x = assoc_table, path = assoc_path) + readr::write_rds(assoc_table, assoc_path) assoc_table } @@ -125,7 +125,7 @@ change_special_author <- function(author_id, change_matrix <- projects_table[special_author_cols] == author_id if (isTRUE(any(change_matrix))) { projects_table[special_author_cols][change_matrix] <- new_value - readr::write_rds(x = projects_table, path = projects_path) + readr::write_rds(projects_table, projects_path) } } } diff --git a/R/setup.R b/R/setup.R index 220e24f..ac64850 100755 --- a/R/setup.R +++ b/R/setup.R @@ -227,7 +227,7 @@ set_Renviron <- function(projects_folder_path, .Renviron_path) { ) ) - readr::write_lines(Renviron_entries, path = .Renviron_path) + readr::write_lines(Renviron_entries, .Renviron_path) Sys.setenv(PROJECTS_FOLDER_PATH = projects_folder_path) } @@ -360,7 +360,7 @@ restore_metadata <- function(path) { if (fs::file_exists(rds_path)) { tibble <- vec_rbind(readRDS(rds_path), tibble) } - readr::write_rds(x = tibble, path = rds_path) + readr::write_rds(tibble, rds_path) } ) } diff --git a/R/update.R b/R/update.R index 3ac33af..92bf0e4 100644 --- a/R/update.R +++ b/R/update.R @@ -102,7 +102,7 @@ update_metadata <- function(ask = TRUE) { projects_table$creator <- creator_results$results } - readr::write_rds(x = projects_table, path = projects_path) + readr::write_rds(projects_table, projects_path) message("\nProjects metadata updated.") diff --git a/README.md b/README.md index 5d666bd..240bbe8 100644 --- a/README.md +++ b/README.md @@ -378,7 +378,7 @@ library(projects) ``` r setup_projects("~") #> projects folder created at -#> /tmp/RtmpBBoEOw/projects +#> /tmp/RtmpH0SVxn/projects #> #> Add affiliations with new_affiliation(), #> then add authors with new_author(), @@ -579,7 +579,7 @@ new_project( ) #> #> Project 1 has been created at -#> /tmp/RtmpBBoEOw/projects/p0001 +#> /tmp/RtmpH0SVxn/projects/p0001 #> # A tibble: 1 x 6 #> id title stage status deadline_type deadline #> @@ -620,7 +620,7 @@ new_project( ) #> #> Project 2 has been created at -#> /tmp/RtmpBBoEOw/projects/p0002 +#> /tmp/RtmpH0SVxn/projects/p0002 #> # A tibble: 1 x 6 #> id title stage status deadline_type deadline #> @@ -653,7 +653,7 @@ new_project( ) #> #> Project 1945 has been created at -#> /tmp/RtmpBBoEOw/projects/top_secret/p1945 +#> /tmp/RtmpH0SVxn/projects/top_secret/p1945 #> # A tibble: 1 x 6 #> id title stage status deadline_type deadline #> @@ -682,7 +682,7 @@ new_project( ) #> #> Project 3 has been created at -#> /tmp/RtmpBBoEOw/projects/p0003 +#> /tmp/RtmpH0SVxn/projects/p0003 #> # A tibble: 1 x 6 #> id title stage status deadline_type deadline #> @@ -801,9 +801,9 @@ projects(verbose = TRUE) %>% select(id, short_title, path) #> # A tibble: 3 x 3 #> id short_title path #> -#> 1 1945 Dr. Strangelove /tmp/RtmpBBoEOw/projects/top_secret/p1945 -#> 2 2 Eureka! /tmp/RtmpBBoEOw/projects/p0002 -#> 3 3 Rn86 /tmp/RtmpBBoEOw/projects/p0003 +#> 1 1945 Dr. Strangelove /tmp/RtmpH0SVxn/projects/top_secret/p1945 +#> 2 2 Eureka! /tmp/RtmpH0SVxn/projects/p0002 +#> 3 3 Rn86 /tmp/RtmpH0SVxn/projects/p0003 ``` Users can also create subdirectories with the function @@ -813,7 +813,7 @@ Users can also create subdirectories with the function new_project_group("Greek_studies/ancient_studies") #> #> The following directory was created: -#> /tmp/RtmpBBoEOw/projects/Greek_studies/ancient_studies +#> /tmp/RtmpH0SVxn/projects/Greek_studies/ancient_studies ``` If a project has already been created, it can be moved **not** with @@ -833,7 +833,7 @@ move_project("Crown", path = "Greek_studies/ancient_studies") #> # creator #> #> Project 2 moved so that its new path is -#> /tmp/RtmpBBoEOw/projects/Greek_studies/ancient_studies/p0002 +#> /tmp/RtmpH0SVxn/projects/Greek_studies/ancient_studies/p0002 copy_project( project_to_copy = "Radon", @@ -848,7 +848,7 @@ copy_project( #> # creator #> #> Project 4 below is a copy of project 3 and is located at -#> /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_studies/radon_studies/p0004 +#> /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_studies/radon_studies/p0004 #> # A tibble: 1 x 11 #> id title short_title current_owner status deadline_type deadline #> @@ -857,9 +857,9 @@ copy_project( #> # creator #> #> The .Rproj file -#> /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_studies/radon_studies/p0004/p0003.Rproj +#> /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_studies/radon_studies/p0004/p0003.Rproj #> was renamed to -#> /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_studies/radon_studies/p0004/p0004.Rproj +#> /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_studies/radon_studies/p0004/p0004.Rproj #> #> Be sure to change all instances of "p0003" to "p0004" as desired #> (e.g., .bib files and references to them in YAML headers). @@ -870,9 +870,9 @@ projects(c("Crown", "Radon"), verbose = TRUE) %>% select(id, title, path) #> # A tibble: 3 x 3 #> id title path #> -#> 1 2 Weighing the C… /tmp/RtmpBBoEOw/projects/Greek_studies/ancient_studies/… -#> 2 4 Understanding … /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_… -#> 3 3 Understanding … /tmp/RtmpBBoEOw/projects/p0003 +#> 1 2 Weighing the C… /tmp/RtmpH0SVxn/projects/Greek_studies/ancient_studies/… +#> 2 4 Understanding … /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_… +#> 3 3 Understanding … /tmp/RtmpH0SVxn/projects/p0003 ``` Projects can also be archived; they are moved into a subdirectory called @@ -890,7 +890,7 @@ archive_project("Strangelove") #> # creator #> #> The above project was archived and has the file path -#> /tmp/RtmpBBoEOw/projects/top_secret/archive/p1945 +#> /tmp/RtmpH0SVxn/projects/top_secret/archive/p1945 ``` When a project is archived, it is no longer included in `projects()` @@ -901,18 +901,18 @@ projects(verbose = TRUE) %>% select(id, short_title, path) #> # A tibble: 3 x 3 #> id short_title path #> -#> 1 2 Eureka! /tmp/RtmpBBoEOw/projects/Greek_studies/ancient_studies/p0002 -#> 2 4 /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_stud… -#> 3 3 Rn86 /tmp/RtmpBBoEOw/projects/p0003 +#> 1 2 Eureka! /tmp/RtmpH0SVxn/projects/Greek_studies/ancient_studies/p0002 +#> 2 4 /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_stud… +#> 3 3 Rn86 /tmp/RtmpH0SVxn/projects/p0003 projects(verbose = TRUE, archived = TRUE) %>% select(id, short_title, path) #> # A tibble: 4 x 3 #> id short_title path #> -#> 1 1945 Dr. Strangelo… /tmp/RtmpBBoEOw/projects/top_secret/archive/p1945 -#> 2 2 Eureka! /tmp/RtmpBBoEOw/projects/Greek_studies/ancient_studies/p… -#> 3 4 /tmp/RtmpBBoEOw/projects/dangerous_studies/radioactive_s… -#> 4 3 Rn86 /tmp/RtmpBBoEOw/projects/p0003 +#> 1 1945 Dr. Strangelo… /tmp/RtmpH0SVxn/projects/top_secret/archive/p1945 +#> 2 2 Eureka! /tmp/RtmpH0SVxn/projects/Greek_studies/ancient_studies/p… +#> 3 4 /tmp/RtmpH0SVxn/projects/dangerous_studies/radioactive_s… +#> 4 3 Rn86 /tmp/RtmpH0SVxn/projects/p0003 ``` Lastly, affiliations, authors and projects can be deleted with the @@ -974,7 +974,7 @@ various stages of development. # References -
+
diff --git a/cran-comments.md b/cran-comments.md index 859d275..fd16990 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,9 @@ +## Update to version 2.1.3 +There were no ERRORs, WARNINGs. + +NOTE on some platforms objecting to `methods` being in the `Imports` list. + ## Update to version 2.1.2 There were no ERRORs, WARNINGs. diff --git a/inst/templates/04_report.Rmd b/inst/templates/04_report.Rmd index 6a31ac7..f5ed721 100644 --- a/inst/templates/04_report.Rmd +++ b/inst/templates/04_report.Rmd @@ -13,9 +13,7 @@ Funding: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) -``` -```{r load_libraries, include=FALSE} library(projects) library(here) library(tidyverse) diff --git a/inst/templates/CONSORT_protocol.Rmd b/inst/templates/CONSORT_protocol.Rmd index 60bd7b8..a406f5e 100644 --- a/inst/templates/CONSORT_protocol.Rmd +++ b/inst/templates/CONSORT_protocol.Rmd @@ -15,10 +15,7 @@ Funding: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) -``` - -```{r load_libraries, include=FALSE} library(projects) library(here) library(tidyverse) diff --git a/inst/templates/STROBE_protocol.Rmd b/inst/templates/STROBE_protocol.Rmd index 76b33b3..cbfbbfb 100644 --- a/inst/templates/STROBE_protocol.Rmd +++ b/inst/templates/STROBE_protocol.Rmd @@ -15,10 +15,7 @@ Funding: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) -``` - -```{r load_libraries, include=FALSE} library(projects) library(here) library(tidyverse)