Skip to content
Snippets Groups Projects
Commit 2ac1df01 authored by Noam Ross's avatar Noam Ross
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 192 additions and 0 deletions
^\.gitlab-ci\.yml$
^.*\.Rproj$
^\.Rproj\.user$
.drake
artifacts
.git
\ No newline at end of file
# Created by https://www.gitignore.io/api/r
# Edit at https://www.gitignore.io/?templates=r
### R ###
# History files
.Rhistory
.Rapp.history
# Session Data files
.RData
# User-specific files
.Ruserdata
# Example code in package build process
*-Ex.R
# Output files from R CMD build
/*.tar.gz
# Output files from R CMD check
/*.Rcheck/
# RStudio files
.Rproj.user/
# produced vignettes
vignettes/*.html
vignettes/*.pdf
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth
# knitr and R markdown default cache directories
*_cache/
/cache/
# Temporary files created by R markdown
*.utf8.md
*.knit.md
### R.Bookdown Stack ###
# R package: bookdown caching files
/*_files/
# End of https://www.gitignore.io/api/r
.drake
artifacts/*.*
!artifacts/.gitkeep
\ No newline at end of file
stages:
- build-image
- fit
- deploy
build-testing-image:
stage: build-images
image: docker:19.03.1
services:
- docker:19.03.1-dind
variables:
DOCKER_HOST: tcp://docker:2375/
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
only:
changes:
- "DESCRIPTION"
- "Dockerfile"
when: always
run-drake:
stage: fit
image: $CI_REGISTRY_IMAGE:latest
cache:
paths:
- .drake
artifacts:
name: "$CI_JOB_NAME"
paths:
- artifacts/
before_script:
- Rscript -e "remotes::install_deps()"
script:
- make.R
when: always
Package: repel-drake
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person(given = "First",
family = "Last",
role = c("aut", "cre"),
email = "first.last@example.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: What license it uses
Encoding: UTF-8
LazyData: true
Imports:
drake,
tidyverse,
knitr,
rmarkdown,
visNetwork
\ No newline at end of file
FROM rocker/verse:3.6.1
RUN apt-get update && apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages --allow-unauthenticated --no-install-recommends --no-upgrade \
curl
## Install packages
RUN install2.r -s remotes
COPY DESCRIPTION /pkg/DESCRIPTION
RUN Rscript -e "remotes::install_deps(pkgdir = '/pkg/', dependencies=TRUE, upgrade = 'always', force = FALSE, quiet = FALSE)"
# This file contains all the functions of the workflow.
# If needed, you could split it up into multiple files.
# Pick a random subset of n rows from a dataset
random_rows <- function(data, n){
data[sample.int(n = nrow(data), size = n, replace = TRUE), ]
}
# Bootstrapped datasets from mtcars.
simulate <- function(n){
# Pick a random set of cars to bootstrap from the mtcars data.
data <- random_rows(data = mtcars, n = n)
# x is the car's weight, and y is the fuel efficiency.
data.frame(
x = data$wt,
y = data$mpg
)
}
# Try a couple different regression models.
# Is fuel efficiency linearly related to weight?
reg1 <- function(d){
lm(y ~ + x, data = d)
}
# Is fuel efficiency related to the SQUARE of the weight?
reg2 <- function(d){
d$x2 <- d$x ^ 2
lm(y ~ x2, data = d)
}
# Here, load the packages you need for your workflow.
library(drake)
library(knitr)
library(tidyverse)
library(htmlwidgets)
R/plan.R 0 → 100644
# This is where you set up your workflow plan,
# a data frame with the steps of your analysis.
###################
### THE NEW WAY ###
###################
# drake >= 7.0.0 has a new interface for generating plans.
# Read about it at https://ropenscilabs.github.io/drake-manual/plans.html
my_plan <- drake_plan(
report = knit(knitr_in("report.Rmd"), file_out("artifacts/report.md"), quiet = FALSE),
small = simulate(48),
large = simulate(64),
regression1 = target(
reg1(data),
transform = map(data = c(small, large), .tag_out = reg)
),
regression2 = target(
reg2(data),
transform = map(data, .tag_out = reg)
),
summ = target(
suppressWarnings(summary(reg$residuals)),
transform = map(reg)
),
coef = target(
suppressWarnings(summary(reg))$coefficients,
transform = map(reg)
),
model = target(
saveRDS(reg, file_out(!!file.path("artifacts", paste0(.id_chr, ".rds")))),
transform = map(reg)
)
)
This diff is collapsed.
artifacts/drake_graph_files/vis-4.20.1/img/network/acceptDeleteIcon.png

20.2 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/addNodeIcon.png

20.5 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/backIcon.png

20.3 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/connectIcon.png

20.3 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/cross.png

17.9 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/cross2.png

17.4 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/deleteIcon.png

20.5 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/downArrow.png

4.36 KiB

artifacts/drake_graph_files/vis-4.20.1/img/network/editIcon.png

20.5 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment