Skip to content

Commit

Permalink
fixed some bugs in the vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
Monica-Golumbeanu committed Oct 17, 2023
1 parent 5c5cb1f commit 2daf431
Show file tree
Hide file tree
Showing 65 changed files with 1,745 additions and 401 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ VignetteBuilder: knitr
License: GPL (>=2)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
Depends:
R (>= 3.5.0)
4 changes: 1 addition & 3 deletions R/AnophelesModel_db_query.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ get_net_types = function() {
#'
#'
#' @examples
#' net_insecticide_types = get_net_insecticide_types()
#' net_insecticide_types = get_net_insecticides()
#' print(net_insecticide_types)
#'
#' @export
Expand Down Expand Up @@ -285,8 +285,6 @@ get_net_decay = function(net_type, country, insecticide_type, n_ips, duration){
#' @references TO DO
#'
#' @examples
#' net_surv = get_net_survival_and_holed_area()
#' print(net_surv)
#'
#' @export
#'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ To install the package:
```{r}
devtools::install_github("SwissTPH/AnophelesModel", build_vignettes = TRUE)
```
IMPORTANT: To be able to build the vignette during package installation, you need to have the following packages installed: DiagrammeR, ggpubr, and Hmisc.

A documentation describing the package use cases and functions is available [here](https://swisstph.github.io/AnophelesModel/articles/AnophelesModel.html) and can also be accessed using the following R command:
```{r}
browseVignettes(AnophelesModel)
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

686 changes: 565 additions & 121 deletions docs/articles/AnophelesModel.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions docs/articles/AnophelesModel_files/grViz-binding-1.0.10/grViz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
HTMLWidgets.widget({

name: 'grViz',

type: 'output',

initialize: function(el, width, height) {

return {
// TODO: add instance fields as required
};
},

renderValue: function(el, x, instance) {
// Use this to sort of make our diagram responsive
// or at a minimum fit within the bounds set by htmlwidgets
// for the parent container
function makeResponsive(el){
var svg = el.getElementsByTagName("svg")[0];
if (svg) {
if (svg.width) {svg.removeAttribute("width")}
if (svg.height) {svg.removeAttribute("height")}
svg.style.width = "100%";
svg.style.height = "100%";
}
}

if (x.diagram !== "") {

if (typeof x.config === "undefined"){
x.config = {};
x.config.engine = "dot";
x.config.options = {};
}

try {

el.innerHTML = Viz(x.diagram, format="svg", engine=x.config.engine, options=x.config.options);

makeResponsive(el);

if (HTMLWidgets.shinyMode) {
// Get widget id
var id = el.id;

$("#" + id + " .node").click(function(e) {
// Get node id
var nodeid = e.currentTarget.id;
// Get node text object and make an array
var node_texts = $("#" + id + " #" + nodeid + " text");
//var node_path = $("#" + nodeid + " path")[0];
var text_array = node_texts.map(function() {return $(this).text(); }).toArray();
// Build return object *obj* with node-id, node text values and node fill
var obj = {
id: nodeid,
//fill: node_path.attributes.fill.nodeValue,
//outerHMTL: node_path.outerHTML,
nodeValues: text_array
};
// Send *obj* to Shiny's inputs (input$[id]+_click e.g.: input$vtree_click))
Shiny.setInputValue(id + "_click", obj, {priority: "event"});
});
}

// set up a container for tasks to perform after completion
// one example would be add callbacks for event handling
// styling
if (typeof x.tasks !== "undefined") {
if ((typeof x.tasks.length === "undefined") ||
(typeof x.tasks === "function")) {
// handle a function not enclosed in array
// should be able to remove once using jsonlite
x.tasks = [x.tasks];
}
x.tasks.map(function(t){
// for each tasks add it to the mermaid.tasks with el
t.call(el);
});
}
} catch(e){
var p = document.createElement("pre");
p.innerText = e;
el.appendChild(p);
}
}

},

resize: function(el, width, height, instance) {
}
});
Loading

0 comments on commit 2daf431

Please sign in to comment.