Code Monkey home page Code Monkey logo

dessert's People

Contributors

gerkovink avatar hanneoberman avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

hanneoberman

dessert's Issues

Uitdaging met specifieke recept parameters

In het kort Dessert

# (1) function users call 
dessert <- function (input, p1, p2, ...) {
  # (2) initiate the dessert object 
  dessert <- Dessert$new(input, p1, ...)

  # (7) apply render method
  dessert$render(p2, ...)

  return(dessert)
}

Dessert <- R6::R6Class(
  name = "Dessert",
  # (3) run initiate method
  initialize = function(input, p, ...) {
    # (4) call class function 
    do.call(dessert.class, ...)
  },
  # (8) run render method
  render = function(p, ...) {
    # (9) store input and markdown parameters in a rdata object
    save(recipe.rdata) 
    quarto::quarto_render(self, ...)
  }
)
# (5) say data.frame class was called
dessert.data.frame <- function(self, ...) {
  # (6) now additional parameters given via an ellipsis
  extra_parameters <- list(...)
  return(self)
}

Uitdaging

Alle specifieke recipe parameters bij stap 6, worden middels een ellipsis doorgegeven. Het is lastig om een validity check te doen op de parameters.

Nu is het mogelijk om parameters in de yml van het qmd te specificeren.

title: "Example Recipe"
param:
  optional_parameter: 123,
  required_parameter

Die worden bij het renderen als een lijst meegegeven:

quarto::quarto_render(self, params = list(optional_parameter = 456, required_parameter = FALSE))

Alleen het markdown bestand, wat wij meegeven aan de gebruiken door middel van: copy.file(markdown), heeft de ingestelde parameter waardes niet. Dus bij het heropenen van het qmd bestand zal de gebruiker zelf die parameters weer moeten invullen.

Creating `Rmd` files from code functions

The first issue we raise is the following. Assume that we have an incomplete data set data that we would run through a standard test suite to benchmark the scope and state of the missingness and run our pre-imputation diagnostics and tests.

For example, something close to the following workflow example:

library(mice)
library(dplyr)
library(magrittr)
# missingness over columns
apply(data, 2, function(x) sum(is.na(x)))
# create missing data pattern plot
data %>% 
  md.pattern()
# Some text that discusses the use and interpretation of the pattern
# Some text that discusses the use and interpretation of the pattern
# Some text that discusses the use and interpretation of the pattern
# investigate bivariate data structure
data %>% 
  cor(use = "pairwise.complete.obs")
# investigate missingness relations
# Some text that discusses the use and interpretation of the relations
# Some text that discusses the use and interpretation of the relations
# Some text that discusses the use and interpretation of the relations
data %>% 
  dep.pattern()
# Some text that discusses the use and interpretation of the pattern
# Some text that discusses the use and interpretation of the pattern
# Some text that discusses the use and interpretation of the pattern
# create predictor matrix
data %>% 
  pred
# Some text that discusses the use and interpretation of the predictor matrix
# Some text that discusses the use and interpretation of the predictor matrix
# Some text that discusses the use and interpretation of the predictor matrix

Question 1 How can we realise that the above code is parsed through dessert(data) such that the following components are generated:

  1. A Rmd file that takes as input object data
  2. A compiled html file, with the option to generate additionally a .pdf or .docx file, cf. pandoc
  3. [??optionally because of data sharing concerns??] An .Rstudio project with folder that holds the data as an .Rdata file
  4. A README.md file that holds information about the dessert package, version and function used to generate the archive.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.