Skip to content

Commit

Permalink
Merge pull request #57 from aghaynes/master
Browse files Browse the repository at this point in the history
update template code
  • Loading branch information
aghaynes authored Mar 21, 2024
2 parents 8ba4b4b + fe6c80e commit ea27393
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'oldrel-1'}
#- {os: windows-latest, r: '3.6'}
# - {os: ubuntu-20.04, r: '4.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-latest, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
#- {os: ubuntu-20.04, r: '4.1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-latest, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2
- name: Install rmarkdown, remotes, and the local package
run: |
install.packages(c("devtools", "badger"))
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: CTUtemplate
Title: Example RStudio Project Templates
Author: Alan G. Haynes
Maintainer: Alan G. Haynes <alan.haynes@ctu.unibe.ch>
Version: 0.4.7
Maintainer: Alan G. Haynes <[email protected]>
Version: 0.5.0
Description: Templates and functions for use in CTU Bern.
Depends:
R (>= 3.3.2)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
CTUtemplate 0.5.0
---------------------
addition of template R code for saving data as CSV
addition of example code for using groundhog

CTUtemplate 0.4.7
---------------------
addition of `coloured_text` for using in quarto/RMarkdown documents to more easily colour particular pieces of text
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# `CTUtemplate` <img src='man/figures/sticker.png' align="right" width="200">

[![](https://img.shields.io/badge/dev%20version-0.4.7-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)
[![](https://img.shields.io/badge/dev%20version-0.5.0-blue.svg)](https://github.com/CTU-Bern/CTUtemplate)

`CTUtemplate` is a package to create a template directory structure (and
files) and also includes the CTUs annual safety report function.
Expand Down Expand Up @@ -85,7 +85,7 @@ info.
generic template with some examples of how to do things.

| Function | Description |
| :-------------------------- | :----------------------------------------------------------------------------------- |
|:----------------------------|:-------------------------------------------------------------------------------------|
| `use_report_template` | Opens a generic file with various examples |
| `use_ssreport_template` | Opens a template for a sample size report |
| `use_recreport_template` | Opens a template for a recruitment report |
Expand Down
22 changes: 22 additions & 0 deletions inst/extdata/R/dataprep.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ mykeep()
# dat <- read_secuTrial(paths$od("zipname.zip"))
# dat < redcap_export_byform(readLines("O:/tokens/projNum.txt"),
# "https://redcap.ctu.unibe.ch/api/")
# alternative REDCap export code. also saves data as CSV
# if(export_date == Sys.Date()){
# dat <- redcap_export_byform(readLines("O:/tokens/projNum.txt"),
# "https://redcap.ctu.unibe.ch/api/")
# meta <- redcap_export_meta(readLines("O:/tokens/projNum.txt"),
# "https://redcap.ctu.unibe.ch/api/")
# lapply(names(dat), function(x){
# write.csv(dat[[x]], paths$od(paste0(x, "-", export_date, ".csv")),
# na = "", row.names = FALSE)
# return(NULL)
# })
# lapply(names(meta), function(x){
# write.csv(meta[[x]], paths$od(paste0(x, "-", export_date, ".csv")),
# na = "", row.names = FALSE)
# return(NULL)
# })
# saveRDS(dat, paths$od(paste0("raw-", export_date, ".RDS")))
# saveRDS(meta, paths$od(paste0("meta-", export_date, ".RDS")))
# }
#
# dat <- readRDS(paths$od(paste0("raw-", export_date, ".RDS")))
# meta <- readRDS(paths$od(paste0("meta-", export_date, ".RDS")))

# example using mtcars
data(mtcars)
Expand Down
4 changes: 4 additions & 0 deletions inst/extdata/R/packages_funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# install.packages("redcaptools", repos = "https://ctu-bern.r-universe.dev")
# install.packages("secuTrialR")

# install.packages("groundhog")
# library.groundhog(" #UNCOMMENT TO USE GROUNDHOG

## Load packages ----
# library(atable)
# atable_options(format_to = "console", add_margins = TRUE)
Expand All @@ -31,6 +34,7 @@
# library(btabler)
# library(sse)

# ", date = "2024-02-01") #UNCOMMENT TO USE GROUNDHOG

# custom functions ----
# function to retain only named objects (+ 'paths', pp and functions)
Expand Down

0 comments on commit ea27393

Please sign in to comment.