drake-r-package

How to combine multiple drake targets into a single cross target without combining the datasets?

旧街凉风 提交于 2021-01-05 09:45:07
问题 Drake rocks! I have a complex multistage processing problem. The problem can be illustrated with this example. I have 2 processes at level l, and I want all the datasets generated by all the level 1 processes to be processed by a single target at level 2. The code below does what I want, but I have to repeat the code at level 2, and in my complex situation, this seems wrong. library(drake) library(tidyverse) f_process1a = function(x) { x } f_process1b = function(x) { x } f_process2 = function

How to use shiny app as a target in drake

断了今生、忘了曾经 提交于 2020-08-26 10:12:06
问题 How to pass previous target ( df ) to ui and server functions that I use in the next command shinyApp . My plan looks like this: plan <- drake_plan( df = faithful, app = shinyApp(ui, server) ) ui and server are copied from the shiny tutorial. There's only one difference - I changed faithful to df (data in the previous target). Now I'm getting an error: Warning: Error in $: object of type 'closure' is not subsettable [No stack trace available] How to solve this? What's the best practice? 回答1:

How to deploy shiny app to shinyapps.io from drake plan

不打扰是莪最后的温柔 提交于 2020-08-10 19:08:31
问题 This is a follow-on question from closing the loop on passing the app and data to a Shiny deployment function: How to use shiny app as a target in drake I would like to deploy a Shiny app directly from a drake plan as below. library(drake) library(shiny) plan <- drake_plan( cars_data = mtcars, deployment = custom_deployment_function(file_in("app.R"), cars_data) ) custom_shiny_deployment <- function(file, data_input) { rsconnect::deployApp( appFiles = file, appName = "cars", forceUpdate = TRUE

Using rvest with drake: external pointer is not valid error

对着背影说爱祢 提交于 2020-04-30 10:10:39
问题 When I first run the code below, everything is ok. But when I change something in html_file %>%... comand, for example commenting tolower() , I get the following error: Error: target title failed. diagnose(title)error$message: external pointer is not valid diagnose(title)error$calls: 1. └─html_file %>% html_nodes("h2") %>% html_text() Code: library(rvest) library(drake) some_string <- ' <div class="main"> <h2>A</h2> <div class="route">X</div> </div> ' html_file <- read_html(some_string) title

Using rvest with drake: external pointer is not valid error

倖福魔咒の 提交于 2020-04-30 10:07:28
问题 When I first run the code below, everything is ok. But when I change something in html_file %>%... comand, for example commenting tolower() , I get the following error: Error: target title failed. diagnose(title)error$message: external pointer is not valid diagnose(title)error$calls: 1. └─html_file %>% html_nodes("h2") %>% html_text() Code: library(rvest) library(drake) some_string <- ' <div class="main"> <h2>A</h2> <div class="route">X</div> </div> ' html_file <- read_html(some_string) title

How to refer to previous targets in drake?

你离开我真会死。 提交于 2019-12-23 21:56:39
问题 I would like to use the wildcard to generate a bunch of targets, and then have another set of targets that refers to those original targets. I think this example represents my idea: plan <- drake_plan( sub_task = runif(1000, min = mean__, max = 50), full_task = sub_task * 2 ) step <- 1:4 full_plan <- evaluate_plan( plan, rules = list( mean__ = step ) ) So what I get now is 5 targets, 4 sub_tasks and a single final_task. What I'm looking for is to get 8 targets. The 4 sub_tasks (that are good)