Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
i2dash
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
loosolab
software
i2dash
Commits
c29de5b8
Commit
c29de5b8
authored
5 years ago
by
jens.preussner
👻
Browse files
Options
Downloads
Patches
Plain Diff
Added i2dash global setup
parent
de9bf816
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/assemble.R
+14
-4
14 additions, 4 deletions
R/assemble.R
inst/templates/i2dash-global-setup.Rmd
+9
-0
9 additions, 0 deletions
inst/templates/i2dash-global-setup.Rmd
with
23 additions
and
4 deletions
R/assemble.R
+
14
−
4
View file @
c29de5b8
...
...
@@ -13,6 +13,7 @@ setMethod("assemble", "i2dashboard", function(object, output_file, pages, ...) {
yaml_list
<-
list
(
title
=
object
@
title
,
author
=
object
@
author
,
output
=
list
(
"flexdashboard::flex_dashboard"
=
list
(
theme
=
object
@
theme
)))
if
(
object
@
interactive
){
yaml_list
[[
"runtime"
]]
<-
"shiny"
}
...
...
@@ -20,10 +21,22 @@ setMethod("assemble", "i2dashboard", function(object, output_file, pages, ...) {
header_string
<-
paste0
(
"---\n"
,
yaml_part
,
"---\n"
)
tmp_document
<-
tempfile
()
# create variable final_document
final_document
<-
file.path
(
object
@
workdir
,
output_file
)
# write header to tempfile
cat
(
header_string
,
file
=
tmp_document
,
append
=
FALSE
,
sep
=
''
)
cat
(
header_string
,
file
=
tmp_document
,
append
=
FALSE
,
sep
=
''
)
# Add i2dash global setup
cat
(
readLines
(
system.file
(
"templates"
,
"i2dash-global-setup.Rmd"
,
package
=
"i2dash"
)),
file
=
tmp_document
,
append
=
T
,
sep
=
""
)
# write page to tempfile
for
(
pagename
in
pages
){
name
<-
.create_page_name
(
pagename
)
...
...
@@ -50,9 +63,6 @@ setMethod("assemble", "i2dashboard", function(object, output_file, pages, ...) {
timestamp
<-
Sys.time
()
full_content
<-
knitr
::
knit_expand
(
file
=
system.file
(
"templates"
,
"page_template.Rmd"
,
package
=
"i2dash"
),
title
=
title
,
layout_with_menu
=
layout_with_menu
,
components
=
components
,
date
=
timestamp
)
cat
(
full_content
,
file
=
tmp_document
,
append
=
TRUE
,
sep
=
''
)
#cat(object@pages[[name]]$header, file = tmp_document, append = TRUE, sep='')
#cat(object@pages[[name]]$components, file = tmp_document, append = TRUE, sep='')
}
else
{
warning
(
sprintf
(
"i2dashboard object does not contain a page named '%s'"
,
pagename
))
}
...
...
This diff is collapsed.
Click to expand it.
inst/templates/i2dash-global-setup.Rmd
0 → 100644
+
9
−
0
View file @
c29de5b8
```{r i2dash-global-setup}
# Deal with operation within a switchr environment
if (any(grepl(pattern = ".switchr", x = .libPaths()))) {
switchr::switchrNoUnload(TRUE)
}
# Make it possible to reuse chunk labels
options(knitr.duplicate.label = "allow")
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment