Skip to content

Commit

Permalink
merge back from neuhausi/cx (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
cb4ds authored Nov 15, 2018
1 parent 17a6051 commit 4e0142f
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 43 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ BugReports:
Depends:
R (>= 3.3.0)
Imports:
htmlwidgets (>= 0.8)
htmlwidgets (>= 0.8),
httr
RoxygenNote: 6.0.1
Suggests:
shiny (>= 0.13.2),
Expand Down
16 changes: 13 additions & 3 deletions R/canvasXpress.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,19 @@ canvasXpress <- function(data = NULL,
z <- NULL
dataframe <- "columns"
precalc.names <- c("iqr1", "qtl1", "median", "qtl3", "iqr3", "outliers")


if (graphType == "Venn") {

# Implement data in URL
if (is.character(data)) {
if (httr::http_error(data)) {
stop("Not a valid URL!")
}
# CanvasXpress Object
cx_object <- list(data = data,
config = config,
events = events,
afterRender = afterRender)
}
else if (graphType == "Venn") {
vdata <- NULL
if (is.null(data)) {
if (inherits(config$vennData, "list")) {
Expand Down
18 changes: 12 additions & 6 deletions R/internal_functionality.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ assertDataCorrectness <- function(data, graphType, config) {
paste(validGraphTypes, collapse = ", "), ">")
}

# for backwards compatibility we accept both data and vennData
if (graphType == "Venn") {
# Implement data in URL
if (is.character(data)) {
if (httr::http_error(data)) {
stop("Not a valid URL!")
}
}
# for backwards compatibility we accept both data and vennData
else if (graphType == "Venn") {
vdata <- data

if (is.null(vdata)) {
Expand Down Expand Up @@ -72,12 +78,12 @@ assertDataCorrectness <- function(data, graphType, config) {
stop("edgeData cannot be NULL!")
}

if (!inherits(ndata, c("data.frame", "matrix"))) {
stop("nodeData must be a data.frame or matrix")
if (!inherits(ndata, c("data.frame", "matrix", "list"))) {
stop("nodeData must be a data.frame or matrix or named list")
}

if (!inherits(edata, c("data.frame", "matrix"))) {
stop("edgeData must be a data.frame or matrix")
if (!inherits(edata, c("data.frame", "matrix", "list"))) {
stop("edgeData must be a data.frame or matrix or named list")
}
}
else if (!(graphType %in% noDataNecessary)) {
Expand Down
Loading

0 comments on commit 4e0142f

Please sign in to comment.