Skip to content

Commit d52285b

Browse files
committed
Initial commit
0 parents  commit d52285b

15 files changed

+312
-0
lines changed

.Rbuildignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
Makefile

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata

DESCRIPTION

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Package: PACKAGE
2+
Title: Organising Projects
3+
Version: 2020.5.25
4+
Authors@R: c(
5+
person(c("Richard","Aubrey"), "White", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6747-1726")),
6+
person(given = "Folkehelseinstituttet", role = c("cph"))
7+
)
8+
Description: A system to help you organize projects. Most analyses have three (or more) main sections: code, results, and data, each with different requirements (version control/sharing/encryption). You provide folder locations and 'org' helps you take care of the details.
9+
Depends: R (>= 3.3.0)
10+
License: MIT + file LICENSE
11+
URL: https://docs.sykdomspulsen.no/PACKAGE, https://github.com/sykdomspulsen-org/PACKAGE
12+
BugReports: https://github.com/sykdomspulsen-org/PACKAGE/issues
13+
Encoding: UTF-8
14+
LazyData: true
15+
Imports: data.table,
16+
magrittr,
17+
ggplot2
18+
Suggests: testthat,
19+
knitr,
20+
rmarkdown,
21+
rstudioapi,
22+
glue
23+
RoxygenNote: 7.1.1
24+
VignetteBuilder: knitr

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2021
2+
COPYRIGHT HOLDER: Folkehelseinstituttet

Makefile

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# h/t to @jimhester and @yihui for this parse block:
2+
# https://github.com/yihui/knitr/blob/dc5ead7bcfc0ebd2789fe99c527c7d91afb3de4a/Makefile#L1-L4
3+
# Note the portability change as suggested in the manual:
4+
# https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Writing-portable-packages
5+
export PKGNAME=`sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION`
6+
export PKGVERS=`sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION`
7+
export DATETIME=`date +%Y-%m-%d\ %H:%M:%S`
8+
export DATETIMEUTC=`date -u +%Y-%m-%d\ %H:%M:%S`
9+
export DATE=`date +%Y.%-m.%-d`
10+
11+
#export PWD=$(abspath $(lastword $(MAKEFILE_LIST)))
12+
13+
all: build
14+
15+
.ONESHELL:
16+
fix_description_version:
17+
sed -i "s/^Version: .*/Version: $(DATE)/" DESCRIPTION
18+
sed -i '/Date\/Publication:/d' DESCRIPTION # delete if exists
19+
echo "Date/Publication: $(DATETIMEUTC) UTC" >> DESCRIPTION #append to bottom
20+
sudo chmod -R 777 ..
21+
22+
.ONESHELL:
23+
build_data:
24+
sudo podman run --rm --privileged \
25+
-v $(shell pwd):/rpkg \
26+
docker.io/fhix/rfhiverse:latest /bin/bash -c \
27+
'Rscript -e "devtools::load_all(\"/rpkg/\"); gen_data_all(\"/rpkg/data\")"'
28+
sudo chmod -R 777 ..
29+
30+
.ONESHELL:
31+
build_package:
32+
sudo rm -rf ../built
33+
mkdir ../built
34+
sudo podman run --rm --privileged \
35+
-v $(shell pwd):/rpkg \
36+
-v $(shell pwd)/../built:/built \
37+
docker.io/fhix/rfhiverse:latest /bin/bash -c \
38+
' \
39+
cd /; \
40+
R CMD build /rpkg; \
41+
cp *.tar.gz /built/; \
42+
'
43+
sudo chown -R go ../built
44+
sudo chmod -R 777 ..
45+
46+
.ONESHELL:
47+
check_package:
48+
sudo podman run --rm --privileged \
49+
-v $(shell pwd):/rpkg \
50+
-v $(shell pwd)/../built:/built \
51+
docker.io/fhix/rfhiverse:latest /bin/bash -c \
52+
' \
53+
R CMD check --no-manual /built/*.tar.gz; \
54+
mv *.Rcheck /built/; \
55+
'
56+
57+
sudo chmod -R 777 ..
58+
59+
if grep -Fq "WARNING" ../built/*.Rcheck/00check.log
60+
then
61+
# code if found
62+
exit 1
63+
else
64+
# code if not found
65+
echo "NO WARNINGs"
66+
fi
67+
68+
if grep -Fq "ERROR" ../built/*.Rcheck/00check.log
69+
then
70+
# code if found
71+
exit 1
72+
else
73+
# code if not found
74+
echo "NO ERRORs"
75+
fi
76+
77+
.ONESHELL:
78+
drat:
79+
git -C .. clone [email protected]:folkehelseinstituttet/drat.git --branch gh-pages
80+
sudo podman run --rm --privileged \
81+
-v $(shell pwd):/rpkg \
82+
-v $(shell pwd)/../built:/built \
83+
-v $(shell pwd)/../drat:/drat \
84+
docker.io/fhix/rfhiverse:latest /bin/bash -c 'Rscript -e "drat::insertPackage(fs::dir_ls(\"/built/\", regexp=\".tar.gz\$\"), repodir = \"/drat\")"'
85+
86+
sed -i "/## News/a - **$(PKGNAME) $(PKGVERS)** (linux) inserted at $(DATETIME)" ../drat/README.md
87+
sed -i '1001,\\\$ d' ../drat/README.md # only keep first 1000 lines of readme
88+
89+
git config --global user.email "[email protected]"
90+
git config --global user.name "sykdomspulsen"
91+
92+
git -C ../drat add -A
93+
git -C ../drat commit -am "gocd $(PKGNAME) $(PKGVERS)" #Committing the changes
94+
git -C ../drat push -f origin gh-pages #pushes to master branch
95+
96+
sudo chmod -R 777 ..
97+
98+
.ONESHELL:
99+
pkgdown:
100+
sudo podman run --rm --privileged \
101+
-v $(shell pwd):/rpkg \
102+
-v $(shell pwd)/../built:/built \
103+
-v $(shell pwd)/../drat:/drat \
104+
docker.io/fhix/rfhiverse:latest /bin/bash -c 'Rscript -e "devtools::install(\"/rpkg\", dependencies = TRUE, upgrade = FALSE); pkgdown::build_site(\"/rpkg\")"'
105+
106+
git add .
107+
git commit -am "Pkgdown built"
108+
git subtree split --prefix docs -b gh-pages # create a local gh-pages branch containing the splitted output folder
109+
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
110+
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
111+
112+
sudo chmod -R 777 ..
113+
114+
.ONESHELL:
115+
drat_prune_history:
116+
cd /tmp
117+
git clone "[email protected]:folkehelseinstituttet/drat.git"
118+
cd drat
119+
git config user.name "Sykdomspulsen"
120+
git config user.email "[email protected]"
121+
git config push.default simple
122+
git checkout gh-pages
123+
124+
git checkout --orphan latest_branch
125+
git add -A
126+
git commit -am "Cleaning history" #Committing the changes
127+
git branch -D gh-pages #Deleting master branch
128+
git branch -m gh-pages #renaming branch as master
129+
git -C /tmp/drat push -f origin gh-pages #pushes to master branch

NAMESPACE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
import(data.table)
4+
import(ggplot2)
5+
importFrom(magrittr,"%>%")

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# PACKAGE 2020.2.17
2+
3+
- Package is created

R/3_onAttach.R

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#' @import data.table ggplot2
2+
#' @importFrom magrittr %>%
3+
.onAttach <- function(libname, pkgname) {
4+
packageStartupMessage(paste0(
5+
"PACKAGE ",
6+
# utils::packageDescription("PACKAGE")$Version,
7+
"\n",
8+
"https://docs.sykdomspulsen.no/PACKAGE"
9+
))
10+
}

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# PACKAGE <a href="https://docs.sykdomspulsen.no/PACKAGE"><img src="man/figures/logo.png" align="right" width="120" /></a>
2+
3+
## Overview
4+
5+
[PACKAGE](https://docs.sykdomspulsen.no/PACKAGE) is a system to help you organize projects. Most analyses have three (or more) main sections: code, results, and data, each with different requirements (version control/sharing/encryption). You provide folder locations and 'org' helps you take care of the details.
6+
7+
Read the introduction vignette [here](http://docs.sykdomspulsen.no/PACKAGE/articles/PACKAGE.html) or run `help(package="PACKAGE")`.
8+
9+
## splverse
10+
11+
<a href="https://docs.sykdomspulsen.no/packages"><img src="https://docs.sykdomspulsen.no/packages/splverse.png" align="right" width="120" /></a>
12+
13+
The [splverse](https://docs.sykdomspulsen.no/packages) is a set of R packages developed to help solve problems that frequently occur when performing infectious disease surveillance.
14+
15+
If you want to install the dev versions (or access packages that haven't been released on CRAN), run `usethis::edit_r_profile()` to edit your `.Rprofile`.
16+
17+
Then write in:
18+
19+
```
20+
options(
21+
repos = structure(c(
22+
FHI = "https://folkehelseinstituttet.github.io/drat/",
23+
CRAN = "https://cran.rstudio.com"
24+
))
25+
)
26+
```
27+
28+
Save the file and restart R.
29+
30+
You can now install [splverse](https://docs.sykdomspulsen.no/packages) packages from the FHI registry.
31+
32+
```
33+
install.packages("PACKAGE")
34+
```
35+

_pkgdown.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
url: https://docs.sykdomspulsen.no/PACKAGE
2+
3+
template:
4+
bootstrap: 5
5+
bslib:
6+
primary: "#0054AD"
7+
border-radius: 0.5rem
8+
btn-border-radius: 0.25rem

cran-comments.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Resubmission
2+
3+
This is a resubmission. In this version I have:
4+
5+
- Omitted all redundancies like "R Functions" in my title
6+
- Added more details about my package in my Description text
7+
- Fixed unexecutable code in man/InitialiseProject.Rd
8+
9+
10+
## Test environments
11+
* local Debian 9.5 install, R 3.5.2
12+
* ubuntu 14.04 (on travis-ci), R 3.5.2
13+
* win-builder (devel and release)
14+
15+
## R CMD check results
16+
17+
0 errors | 0 warnings
18+
19+
Notes:
20+
21+
* checking CRAN incoming feasibility ... NOTE
22+
Maintainer: 'Richard White <[email protected]>'
23+
24+
New submission
25+
26+
## Downstream dependencies
27+
28+
none

license.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2021 Folkehelseinstituttet
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

man/figures/logo.png

80.4 KB
Loading

project.Rproj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: No
4+
SaveWorkspace: No
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
AutoAppendNewline: Yes
16+
StripTrailingWhitespace: Yes
17+
18+
BuildType: Package
19+
PackageUseDevtools: Yes
20+
PackageInstallArgs: --no-multiarch --with-keep.source
21+
PackageRoxygenize: rd,collate,namespace

vignettes/PACKAGE.Rmd

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "Introduction to PACKAGE"
3+
author: "Richard White"
4+
date: "2020-02-17"
5+
output: rmarkdown::html_vignette
6+
vignette: >
7+
%\VignetteIndexEntry{Introduction to PACKAGE}
8+
%\VignetteEngine{knitr::rmarkdown}
9+
%\VignetteEncoding{UTF-8}
10+
---
11+
12+
```{r setup, include = FALSE}
13+
knitr::opts_chunk$set(
14+
collapse = TRUE,
15+
comment = "#>"
16+
)
17+
```
18+
19+
## Concept

0 commit comments

Comments
 (0)