Skip to content

Commit

Permalink
re cran comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Jun 17, 2020
1 parent 2ea9f8c commit a7e6d89
Show file tree
Hide file tree
Showing 54 changed files with 197 additions and 72 deletions.
2 changes: 0 additions & 2 deletions CRAN-RELEASE

This file was deleted.

4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: sigmajs
Title: Interface to 'Sigma.js' Graph Visualization Library
Date: 2020-06-10
Date: 2020-06-17
Version: 0.1.5
Authors@R: person("John", "Coene", email = "jcoenep@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6637-4107"))
Authors@R: person("John", "Coene", email = "jcoenep@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6637-4107"))
Description: Interface to 'sigma.js' graph visualization library including animations, plugins and shiny proxies.
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
2 changes: 2 additions & 0 deletions R/animate.R
Expand Up @@ -26,6 +26,8 @@
#' sg_animate(mapping = list(x = "to_x", y = "to_y", size = "to_size"))
#'
#' @seealso \href{https://github.com/jacomyal/sigma.js/tree/master/plugins/sigma.plugins.animate}{official documentation}
#'
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#'
#' @rdname animation
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/buttons.R
Expand Up @@ -59,6 +59,8 @@
#'
#' @note The default class (\code{btn btn-default}) works with Bootstrap 3 (the default framework for Shiny and R markdown).
#'
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#'
#' @export
sg_button <- function(sg, event, ..., position = "top", class = "btn btn-default", tag = htmltools::tags$button, id = NULL){

Expand Down
2 changes: 2 additions & 0 deletions R/camera.R
Expand Up @@ -13,6 +13,8 @@
#' demo("add-camera", package = "sigmajs")
#' }
#'
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#'
#' @noRd
#' @keywords internal
sg_camera <- function(sg, elementId = NULL, initialise = FALSE) {
Expand Down
4 changes: 3 additions & 1 deletion R/cluster.R
Expand Up @@ -32,7 +32,9 @@
#'
#' clustered <- sg_get_cluster(nodes, edges)
#'
#' @return \code{sg_get_cluster} returns nodes with \code{color} variable.
#' @return \code{sg_get_cluster} returns nodes with \code{color} variable while
#' \code{sg_cluster} returns an object of class \code{htmlwidget} which renders
#' the visualisation on print.
#'
#' @rdname cluster
#' @export
Expand Down
12 changes: 8 additions & 4 deletions R/drag.R
Expand Up @@ -19,6 +19,9 @@
#' # proxies
#' demo("drag-nodes", package = "sigmajs")
#' }
#'
#' @return \code{sg_drag_nodes} An object of class \code{htmlwidget} which renders the visualisation on print.
#' While \code{sg_drag_nodes_start_p} and \code{sg_drag_nodes_kill_p}
#'
#' @rdname drag-nodes
#' @export
Expand All @@ -29,8 +32,8 @@ sg_drag_nodes <- function(sg) {

.test_sg(sg)

sg$x$dragNodes <- TRUE
sg
sg$x$dragNodes <- TRUE
sg
}

#' @rdname drag-nodes
Expand All @@ -45,7 +48,8 @@ sg_drag_nodes_start_p <- function(proxy) {
message <- list(id = proxy$id) # create message

proxy$session$sendCustomMessage("sg_drag_nodes_start_p", message)
proxy

proxy
}

#' @rdname drag-nodes
Expand All @@ -60,5 +64,5 @@ sg_drag_nodes_kill_p <- function(proxy) {
message <- list(id = proxy$id) # create message

proxy$session$sendCustomMessage("sg_drag_nodes_kill_p", message)
proxy
proxy
}
2 changes: 2 additions & 0 deletions R/events.R
Expand Up @@ -63,6 +63,8 @@
#'
#' @seealso \href{https://github.com/jacomyal/sigma.js/wiki/Events-API}{official documentation}.
#'
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#'
#' @export
sg_events <- function(sg, events){
if(missing(events))
Expand Down
3 changes: 2 additions & 1 deletion R/export.R
Expand Up @@ -23,7 +23,8 @@
#' sg_export_svg() %>%
#' sg_button("export_svg", "download")
#'
#' # demo("export-graph", package = "sigmajs")
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#' Functions ending in \code{_p} return the \code{proxy}.
#'
#' @rdname export
#' @export
Expand Down
3 changes: 1 addition & 2 deletions R/filter.R
Expand Up @@ -18,8 +18,7 @@
#' \item{\code{sg_filter_undo_p} Undo filters, accepts vector of \code{name}s.}
#' }
#'
#' @examples
#' # demo("filter-nodes", package = "sigmajs")
#' @return The \code{proxy} object.
#'
#' @rdname filter
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/force.R
Expand Up @@ -39,6 +39,8 @@
#' sg_force() %>%
#' sg_force_stop() # stop force after 5 seconds
#'
#' @return Their first arguments, either \code{sg} or \code{proxy}.
#'
#' @seealso \href{https://github.com/jacomyal/sigma.js/tree/master/plugins/sigma.layout.noverlap}{official documentation}
#'
#' @name force
Expand Down
3 changes: 3 additions & 0 deletions R/from_gexf.R
Expand Up @@ -13,6 +13,9 @@
#' sigmajs() %>%
#' sg_from_gexf(gexf)
#' }
#'
#' @return A modified version of the \code{sg} object.
#'
#' @export
sg_from_gexf <- function(sg, file, sd = NULL) {

Expand Down
2 changes: 2 additions & 0 deletions R/from_igraph.R
Expand Up @@ -17,6 +17,8 @@
#' sg_from_igraph(lesmis_igraph, layout) %>%
#' sg_settings(defaultNodeColor = "#000")
#' }
#'
#' @return A modified version of the \code{sg} object.
#'
#' @export
sg_from_igraph <- function(sg, igraph, layout = NULL, sd = NULL) {
Expand Down
2 changes: 2 additions & 0 deletions R/get.R
Expand Up @@ -36,6 +36,8 @@
#' }
#' if(interactive()) shinyApp(ui, server) # run
#'
#' @return The \code{proxy} object.
#'
#' @rdname get_graph
#' @export
sg_get_nodes_p <- function(proxy) {
Expand Down
8 changes: 8 additions & 0 deletions R/graph.R
Expand Up @@ -53,6 +53,8 @@ globalVariables(c("id", "label", "sigmajsdelay", "size"))
#'
#' # all source and target are present in node ids
#' all(c(edges$source, edges$target) %in% nodes$id)
#'
#' @return A modified version of the \code{sg} object.
#'
#' @rdname graph
#' @export
Expand Down Expand Up @@ -166,6 +168,8 @@ sg_nodes2 <- function(sg, data) {
#' sg_add_edges(edges, delay, id, source, target, cumsum = FALSE) %>%
#' sg_force_stop(2300) # stop after all edges added
#'
#' @return A modified version of the \code{sg} object.
#'
#' @rdname add_static
#' @export
sg_add_nodes <- function(sg, data, delay, ..., cumsum = TRUE) {
Expand Down Expand Up @@ -261,6 +265,8 @@ sg_add_edges <- function(sg, data, delay, ..., cumsum = TRUE, refresh = FALSE) {
#' sg_nodes(nodes, id, size, color) %>%
#' sg_drop_nodes(nodes2, id, delay, cumsum = FALSE)
#'
#' @return A modified version of the \code{sg} object.
#'
#' @rdname drop_static
#' @export
sg_drop_nodes <- function(sg, data, ids, delay, cumsum = TRUE) {
Expand Down Expand Up @@ -360,6 +366,8 @@ sg_drop_edges <- function(sg, data, ids, delay, cumsum = TRUE, refresh = FALSE)
#' sg_read_exec() %>%
#' sg_button("read_exec", "Add nodes & edges")
#'
#' @return A modified version of the \code{sg} object.
#'
#' @name read-static
#' @export
sg_read_nodes <- function(sg, data, ..., delay){
Expand Down
38 changes: 16 additions & 22 deletions R/graph_proxies.R
Expand Up @@ -17,6 +17,8 @@
#' @note Have the parameters from your initial graph match that of the node you add, i.e.: if you pass \code{size} in your initial chart,
#' make sure you also have it in your proxy.
#'
#' @return The \code{proxy} object.
#'
#' @rdname add_p
#' @export
sg_add_node_p <- function(proxy, data, ..., refresh = TRUE) {
Expand Down Expand Up @@ -80,6 +82,8 @@ sg_add_edge_p <- function(proxy, data, ..., refresh = TRUE) {
#' @note Have the parameters from your initial graph match that of the node you add, i.e.: if you pass \code{size} in your initial chart,
#' make sure you also have it in your proxy.
#'
#' @return The \code{proxy} object.
#'
#' @rdname adds_p
#' @export
sg_add_nodes_p <- function(proxy, data, ..., refresh = TRUE, rate = "once") {
Expand Down Expand Up @@ -144,10 +148,7 @@ sg_add_edges_p <- function(proxy, data, ..., refresh = TRUE, rate = "once") {
#' @param id Id of edge or node to delete.
#' @param refresh Whether to refresh the graph after node is dropped, required to take effect, if you are running force the algorithm is killed and restarted.
#'
#' @examples
#' \dontrun{
#' demo("drop-node", package = "sigmajs")
#' }
#' @return The \code{proxy} object.
#'
#' @rdname drop_p
#' @export
Expand Down Expand Up @@ -193,11 +194,8 @@ sg_drop_edge_p <- function(proxy, id, refresh = TRUE) {
#'
#' @param proxy An object of class \code{sigmajsProxy} as returned by \code{\link{sigmajsProxy}}.
#' @param refresh Whether to refresh the graph after node is dropped, required to take effect, if you are running force the algorithm is killed and restarted.
#'
#' @examples
#' \dontrun{
#' demo("clear-graph", package = "sigmajs")
#' }
#'
#' @return The \code{proxy} object.
#'
#' @rdname clear-kill
#' @export
Expand Down Expand Up @@ -247,13 +245,8 @@ sg_kill_p <- function(proxy, refresh = TRUE) {
#' of the delay to effectively add each row one after the other: delay is thus applied at each row (number of seconds to wait
#' before the row is added *since the previous row*). If \code{FALSE} this is the number of milliseconds to wait before the node or
#' edge is added to the visualisation; \code{delay} is used as passed to the function.
#'
#' @examples
#' \dontrun{
#' demo("add-nodes-delay", package = "sigmajs") # add nodes with a delay
#' demo("add-edges-delay", package = "sigmajs") # add edges with a delay
#' demo("add-delay", package = "sigmajs") # add nodes and edges with a delay
#' }
#'
#' @return The \code{proxy} object.
#'
#' @note Have the parameters from your initial graph match that of the node you add, i.e.: if you pass \code{size} in your initial chart,
#' make sure you also have it in your proxy.
Expand Down Expand Up @@ -330,6 +323,8 @@ sg_add_edges_delay_p <- function(proxy, data, delay, ..., refresh = TRUE, cumsum
#' @param refresh Whether to refresh the graph after node is dropped, required to take effect.
#' @param rate Refresh rate, either \code{once}, the graph is refreshed after data.frame of nodes is added or at each \code{iteration} (row-wise). Only applies if \code{refresh} is set to \code{TRUE}.
#'
#' @return The \code{proxy} object.
#'
#' @note Have the parameters from your initial graph match that of the node you add, i.e.: if you pass \code{size} in your initial chart,
#' make sure you also have it in your proxy.
#'
Expand Down Expand Up @@ -398,12 +393,7 @@ sg_drop_edges_p <- function(proxy, data, ids, refresh = TRUE, rate = "once") {
#' before the row is dropped *since the previous row*). If \code{FALSE} this is the number of milliseconds to wait before the node or
#' edge is added to the visualisation; \code{delay} is used as passed to the function.
#'
#' @examples
#' \dontrun{
#' demo("drop-nodes-delay", package = "sigmajs") # add nodes with a delay
#' demo("drop-edges-delay", package = "sigmajs") # add edges with a delay
#' demo("drop-delay", package = "sigmajs") # add nodes and edges with a delay
#' }
#' @return The \code{proxy} object.
#'
#' @note Have the parameters from your initial graph match that of the node you add, i.e.: if you pass \code{size} in your initial chart,
#' make sure you also have it in your proxy.
Expand Down Expand Up @@ -542,6 +532,8 @@ sg_drop_edges_delay_p <- function(proxy, data, ids, delay, refresh = TRUE, cumsu
#'
#' if(interactive()) shinyApp(ui, server)
#'
#' @return The \code{proxy} object.
#'
#' @name read
#' @export
sg_read_nodes_p <- function(proxy, data, ...){
Expand Down Expand Up @@ -657,6 +649,8 @@ sg_read_exec_p <- function(proxy){
#'
#' if(interactive()) shinyApp(ui, server)
#'
#' @return The \code{proxy} object.
#'
#' @name read-batch
#' @export
sg_read_delay_nodes_p <- function(proxy, data, ..., delay){
Expand Down
4 changes: 4 additions & 0 deletions R/helpers.R
Expand Up @@ -104,6 +104,8 @@ sg_make_nodes_edges <- function(n, ...){
#'
#' @inheritParams sg_nodes
#'
#' @return A modified version of the \code{sg} object.
#'
#' @rdname clear-kill
#' @export
sg_kill <- function(sg){
Expand Down Expand Up @@ -138,6 +140,8 @@ sg_clear <- function(sg){
#' sg_nodes(nodes, id, size) %>%
#' sg_scale_color(pal = c("red", "blue"))
#'
#' @return A modified version of the \code{sg} object.
#'
#' @name color-scale
#' @export
sg_scale_color <- function(sg, pal){
Expand Down
2 changes: 2 additions & 0 deletions R/neighbours.R
Expand Up @@ -15,6 +15,8 @@
#' sg_edges(edges, id, source, target) %>%
#' sg_layout() %>%
#' sg_neighbours()
#'
#' @return A modified version of the \code{sg} object.
#'
#' @rdname neighbours
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/noverlap.R
Expand Up @@ -16,6 +16,8 @@
#' sg_edges(edges, id, source, target) %>%
#' sg_layout() %>%
#' sg_noverlap()
#'
#' @return The first argument either \code{sg} or \code{proxy}.
#'
#' @rdname noverlap
#' @export
Expand Down
2 changes: 2 additions & 0 deletions R/relative-size.R
Expand Up @@ -13,6 +13,8 @@
#' sg_nodes(nodes, id, label) %>% # no need to pass size
#' sg_edges(edges, id, source, target) %>%
#' sg_relative_size()
#'
#' @return A modified version of the \code{sg} object.
#'
#' @export
sg_relative_size <- function(sg, initial = 1) {
Expand Down
4 changes: 3 additions & 1 deletion R/sigmajs.R
Expand Up @@ -28,7 +28,9 @@ sigmajs_render <- function(sg){
#' @note Keep \code{width} at \code{100\%} for a responsive visualisation.
#'
#' @seealso \code{\link{sg_kill}}.
#'
#'
#' @return An object of class \code{htmlwidget} which renders the visualisation on print.
#'
#' @export
sigmajs <- function(type = NULL, width = "100%", kill = FALSE, height = NULL, elementId = NULL) {

Expand Down
2 changes: 2 additions & 0 deletions R/text.R
Expand Up @@ -33,6 +33,8 @@
#' sg_progress(nodes2, delay, text, element = "h3") %>%
#' sg_button(c("add_nodes", "progress"), "add")
#'
#' @return A modified version of the \code{sg} object.
#'
#' @export
sg_progress <- function(sg, data, delay, text, ..., position = "top", id = NULL,
tag = htmltools::span, cumsum = TRUE){
Expand Down
2 changes: 0 additions & 2 deletions R/zzz.R
Expand Up @@ -7,9 +7,7 @@ storage_env <- new.env(hash = TRUE)
}

.onLoad <- function(libname, pkgname) {
options(SIGMAJS_STORAGE = FALSE)
shiny::registerInputHandler("sigmajsParseJS", function(data, ...) {
jsonlite::fromJSON(jsonlite::toJSON(data, auto_unbox = TRUE))
}, force = TRUE)
options(SIGMAJS_STORAGE = FALSE)
}

0 comments on commit a7e6d89

Please sign in to comment.