mirror of
https://github.com/agdamsbo/stRoke.git
synced 2024-11-22 04:50:23 +01:00
moved vignettes out
This commit is contained in:
parent
fea603defc
commit
cb81f715d1
@ -28,8 +28,9 @@ Suggests:
|
|||||||
usethis,
|
usethis,
|
||||||
testthat,
|
testthat,
|
||||||
git2r,
|
git2r,
|
||||||
pak
|
pak,
|
||||||
Language: en-US
|
here,
|
||||||
|
rhub
|
||||||
Config/testthat/edition: 3
|
Config/testthat/edition: 3
|
||||||
Imports:
|
Imports:
|
||||||
calendar,
|
calendar,
|
||||||
@ -49,3 +50,4 @@ Imports:
|
|||||||
Depends:
|
Depends:
|
||||||
R (>= 2.10)
|
R (>= 2.10)
|
||||||
VignetteBuilder: knitr
|
VignetteBuilder: knitr
|
||||||
|
Language: en-US
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
Andreas
|
Andreas
|
||||||
CMD
|
|
||||||
Changelog
|
Changelog
|
||||||
Codecov
|
Codecov
|
||||||
DDMMYY
|
DDMMYY
|
||||||
DOI
|
DOI
|
||||||
DataDictionary
|
|
||||||
Gammelgaard
|
Gammelgaard
|
||||||
Github
|
Github
|
||||||
Kraglund
|
Kraglund
|
||||||
Labelling
|
Labelling
|
||||||
METACRAN
|
METACRAN
|
||||||
|
MFI
|
||||||
NA's
|
NA's
|
||||||
OLR
|
OLR
|
||||||
ORCID
|
ORCID
|
||||||
@ -43,11 +42,13 @@ colouring
|
|||||||
cpr
|
cpr
|
||||||
cprs
|
cprs
|
||||||
daDoctoR
|
daDoctoR
|
||||||
|
datetime
|
||||||
ddmmyy
|
ddmmyy
|
||||||
ddmmyyxxxx
|
ddmmyyxxxx
|
||||||
difftime
|
difftime
|
||||||
dk
|
dk
|
||||||
doi
|
doi
|
||||||
|
dplyr
|
||||||
ds
|
ds
|
||||||
eeptools
|
eeptools
|
||||||
eg
|
eg
|
||||||
@ -82,6 +83,7 @@ sapply
|
|||||||
stackoverflow
|
stackoverflow
|
||||||
strsplit
|
strsplit
|
||||||
teppo
|
teppo
|
||||||
|
tibble
|
||||||
vapply
|
vapply
|
||||||
vec
|
vec
|
||||||
winP
|
winP
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
---
|
|
||||||
title: "ds2dd"
|
|
||||||
date: "`r Sys.Date()`"
|
|
||||||
output: rmarkdown::html_vignette
|
|
||||||
vignette: >
|
|
||||||
%\VignetteIndexEntry{ds2dd}
|
|
||||||
%\VignetteEngine{knitr::rmarkdown}
|
|
||||||
%\VignetteEncoding{UTF-8}
|
|
||||||
---
|
|
||||||
|
|
||||||
```{r, include = FALSE}
|
|
||||||
knitr::opts_chunk$set(
|
|
||||||
collapse = TRUE,
|
|
||||||
comment = "#>"
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
```{r setup}
|
|
||||||
library(stRoke)
|
|
||||||
```
|
|
||||||
|
|
||||||
# Easy data set to data base workflow
|
|
||||||
|
|
||||||
This function can be used as a simple tool for creating at data base metadata file for REDCap (called a DataDictionary) based on a given data set file.
|
|
||||||
|
|
||||||
## Step 1 - Load your data set
|
|
||||||
|
|
||||||
Here we'll use the sample TALOS dataset included with the package.
|
|
||||||
|
|
||||||
```{r}
|
|
||||||
data("talos")
|
|
||||||
ds <- talos
|
|
||||||
# As the data set lacks an ID column, one is added
|
|
||||||
ds$id <- seq_len(nrow(ds))
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 2 - Create the DataDictionary
|
|
||||||
|
|
||||||
```{r}
|
|
||||||
datadictionary <- ds2dd(ds,record.id = "id",include.column.names = TRUE)
|
|
||||||
```
|
|
||||||
|
|
||||||
Now additional specifications to the DataDictionary can be made manually, or it can be uploaded and modified manually in the graphical user interface on the web page.
|
|
||||||
|
|
||||||
The function will transform column names to lower case and substitute spaces for underscores. The output is a list with the DataDictionary and a vector of new column names for the dataset to fit the meta data.
|
|
||||||
|
|
||||||
## Step 3 - Meta data upload
|
|
||||||
|
|
||||||
Now the DataDictionary can be exported as a spreadsheet and uploaded or it can be uploaded using the `REDCapR` package (only projects with "Development" status).
|
|
||||||
|
|
||||||
Use one of the two approaches below:
|
|
||||||
|
|
||||||
### Manual upload
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
write.csv(datadictionary$DataDictionary,"datadictionary.csv")
|
|
||||||
```
|
|
||||||
|
|
||||||
### Upload with `REDCapR`
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
REDCapR::redcap_metadata_write(
|
|
||||||
datadictionary$DataDictionary,
|
|
||||||
redcap_uri = keyring::key_get("DB_URI"),
|
|
||||||
token = keyring::key_get("DB_TOKEN")
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
In the ["REDCap R Handbook"](https://agdamsbo.github.io/redcap-r-handbook/) more is written on interfacing with REDCap in R using the `library(keyring)`to store credentials in [chapter 1.1](https://agdamsbo.github.io/redcap-r-handbook/access.html#sec-getting-access).
|
|
||||||
|
|
||||||
## Step 4 - Data upload
|
|
||||||
|
|
||||||
The same two options are available for data upload as meta data upload: manual or through `REDCapR`.
|
|
||||||
|
|
||||||
Only the latter is shown here.
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
# new column names are applied
|
|
||||||
colnames(ds) <- datadictionary$`Column names`
|
|
||||||
|
|
||||||
REDCapR::redcap_write(
|
|
||||||
ds,
|
|
||||||
redcap_uri = keyring::key_get("DB_URI"),
|
|
||||||
token = keyring::key_get("DB_TOKEN")
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
@ -1,145 +0,0 @@
|
|||||||
---
|
|
||||||
title: "New project checklist"
|
|
||||||
date: "`r Sys.Date()`"
|
|
||||||
output: rmarkdown::html_vignette
|
|
||||||
vignette: >
|
|
||||||
%\VignetteIndexEntry{New project checklist}
|
|
||||||
%\VignetteEngine{knitr::rmarkdown}
|
|
||||||
%\VignetteEncoding{UTF-8}
|
|
||||||
---
|
|
||||||
|
|
||||||
## Creating and starting a new project
|
|
||||||
|
|
||||||
This is very much started as a personal reference checklist when starting new *R*-projects.
|
|
||||||
|
|
||||||
Much of it is based on work from [ROSTOOLS](), but I have added a few personal preferences.
|
|
||||||
|
|
||||||
### Init renv
|
|
||||||
|
|
||||||
After initiating renv, do
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
usethis::edit_r_profile()
|
|
||||||
```
|
|
||||||
|
|
||||||
Copy the following to the profile-file:
|
|
||||||
|
|
||||||
```
|
|
||||||
options(
|
|
||||||
renv.settings.snapshot.type = "explicit",
|
|
||||||
renv.config.auto.snapshot = TRUE,
|
|
||||||
renv.config.pak.enabled = TRUE
|
|
||||||
)
|
|
||||||
source("renv/activate.R")
|
|
||||||
|
|
||||||
if (interactive()) {
|
|
||||||
suppressMessages(require(usethis))
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Publishing the project
|
|
||||||
|
|
||||||
Run in terminal:
|
|
||||||
|
|
||||||
```
|
|
||||||
quarto publish gh-pages
|
|
||||||
```
|
|
||||||
|
|
||||||
This will create a new `gh-pages` branches in the repository.
|
|
||||||
|
|
||||||
Then run
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
edit_file(".github/workflows/build-website.yaml")
|
|
||||||
```
|
|
||||||
|
|
||||||
And then copy/paste this content to that file:
|
|
||||||
|
|
||||||
```
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
name: Render and Publish
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pages: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Quarto
|
|
||||||
uses: quarto-dev/quarto-actions/setup@v2
|
|
||||||
with:
|
|
||||||
# To install LaTeX to build PDF book
|
|
||||||
tinytex: true
|
|
||||||
# uncomment below and fill to pin a version
|
|
||||||
# version: 0.9.600
|
|
||||||
|
|
||||||
# The next two steps are used to setup the project when renv is used. Just uncomment and away you go!
|
|
||||||
# - uses: r-lib/actions/setup-r@v2
|
|
||||||
|
|
||||||
# - uses: r-lib/actions/setup-renv@v2
|
|
||||||
|
|
||||||
# From https://github.com/r-lib/actions/tree/v2-branch/setup-r
|
|
||||||
- name: Publish to GitHub Pages (and render)
|
|
||||||
uses: quarto-dev/quarto-actions/publish@v2
|
|
||||||
with:
|
|
||||||
target: gh-pages
|
|
||||||
env:
|
|
||||||
# this secret is always available for github actions
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
```
|
|
||||||
|
|
||||||
# New CRAN release checklist
|
|
||||||
|
|
||||||
- Commit all changes to GIT
|
|
||||||
|
|
||||||
- Checks for publishing with RHUB
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
results <- rhub::check_for_cran()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Let it run. Takes some hours.
|
|
||||||
Check results:
|
|
||||||
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
results$cran_summary()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Copy results to `cran-comments.md`
|
|
||||||
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
usethis::use_cran_comments()
|
|
||||||
```
|
|
||||||
|
|
||||||
- Release on CRAN
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
devtools::release()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Follow instruction on e-mail to confirm upload
|
|
||||||
|
|
||||||
|
|
||||||
- When approved, release to GitHub (this also publishes newest version to Zenodo if setup)
|
|
||||||
|
|
||||||
```{r eval=FALSE}
|
|
||||||
usethis::use_github_release()
|
|
||||||
```
|
|
Loading…
Reference in New Issue
Block a user