Skip to content

Commit

Permalink
shortzened title and replaced T/F with TRUE/FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
erblast committed Nov 29, 2019
1 parent 6b91f45 commit bc90b5f
Show file tree
Hide file tree
Showing 16 changed files with 149 additions and 126 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: parcats
Title: Create 'plotly.js' Parallel Categories Diagrams Using this Htmlwidget and 'easyalluvial'
Title: Interactive Parallel Categories Diagrams for 'easyalluvial'
Version: 0.0.1
Authors@R: person( "Bjoern", "Koneswarakantha", role = c("aut","cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-4585-7799") )
URL: https://erblast.github.io/parcats/
Expand Down
36 changes: 18 additions & 18 deletions R/parcats.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ trace_hist_mod = function(p, data_input, var){
, y1 = max(y_var)
, type = 'line'
, line = list( color = 'lightgrey')
, showlegend = F
, showlegend = FALSE
, name = paste0( var,'_' ,l )
, xref = paste0( 'x', which(vars == var) )
, yref = paste0( 'y', which(vars == var) ) ) )
Expand Down Expand Up @@ -300,7 +300,7 @@ trace_imp = function(p, data_input, truncate_at = 50, color = 'darkgrey'){
, method = p$alluvial_params$method
, text = case_when( plotted == 'y' ~ 'alluvial'
, method == 'pdp' ~ 'pdp'
, T ~ paste('fixed:', const_values) ) ) %>%
, TRUE ~ paste('fixed:', const_values) ) ) %>%
group_by(vars, perc) %>%
mutate( trace = list( list( y = list(vars)
, x = list(perc)
Expand Down Expand Up @@ -442,9 +442,9 @@ create_layout_hist = function(trace_hist
layout_x = list( domain = coord_x[(i*2-1):(i*2)]
#, anchor = yaxis[i]
, anchor = paste0('y1', i)
, showgrid = F
, showline = F
, zeroline = F )
, showgrid = FALSE
, showline = FALSE
, zeroline = FALSE )

layout_x = list(layout_x)

Expand All @@ -458,10 +458,10 @@ create_layout_hist = function(trace_hist
layout_y = list( domain = c(lim_up, 1)
#, anchor = xaxis[i]
#, anchor = paste0('xaxis1', i)
, showgrid = F
, showline = F
, showticklabels = F
, zeroline = F )
, showgrid = FALSE
, showline = FALSE
, showticklabels = FALSE
, zeroline = FALSE )

layout_y = list(layout_y)

Expand Down Expand Up @@ -537,7 +537,7 @@ get_shapes = function(traces){
#'@description creates an interactive parallel categories diagram from an 'easyalluvial'
#' plot using the 'plotly.js' library
#'@param p alluvial plot
#'@param marginal_histograms logical, add marginal histograms, Default: T
#'@param marginal_histograms logical, add marginal histograms, Default: TRUE
#'@param data_input dataframe, data used to create alluvial plot, Default: NULL
#'@param imp dataframe, with not more then two columns one of them numeric
#' containing importance measures and one character or factor column containing
Expand Down Expand Up @@ -614,8 +614,8 @@ get_shapes = function(traces){
#'@importFrom graphics text
#'@importFrom stats density
#'@importFrom utils data
parcats <- function(p, marginal_histograms = T, data_input = NULL
, imp = T
parcats <- function(p, marginal_histograms = TRUE, data_input = NULL
, imp = TRUE
, width = NULL, height = NULL, elementId = NULL
, hoveron = 'color'
, hoverinfo = 'count+probability'
Expand All @@ -633,10 +633,10 @@ parcats <- function(p, marginal_histograms = T, data_input = NULL
stop('data_input required if marginal_histograms == TRUE')
}

if( imp == T & is.null(data_input) & p$alluvial_type == 'model_response' ){
if( imp == TRUE & is.null(data_input) & p$alluvial_type == 'model_response' ){
stop('data_input required if imp == TRUE')
}else if(p$alluvial_type != 'model_response' | ! imp ){
imp = F
imp = FALSE
offset_imp = 1
}

Expand Down Expand Up @@ -695,11 +695,11 @@ parcats <- function(p, marginal_histograms = T, data_input = NULL
traces = append(traces, traces_imp)
layout_imp = list( yaxis99 = list( domain = c(0,1)
, anchor = 'y99'
, showticklabels = F
, showticklabels = FALSE
)
, xaxis99 = list(domain = c(offset_imp,1)
, anchor = 'x99'
, showticklabels = F
, showticklabels = FALSE
) )
layout = append(layout, layout_imp)

Expand Down Expand Up @@ -772,14 +772,14 @@ parcats <- function(p, marginal_histograms = T, data_input = NULL
#' @name parcats-shiny
#'
#' @export
parcatsOutput <- function(outputId, width = '100%', height = '100%', inline = F){
parcatsOutput <- function(outputId, width = '100%', height = '100%', inline = FALSE){
htmlwidgets::shinyWidgetOutput(outputId
, 'parcats'
, width
, height
, package = 'parcats'
, inline = inline
, reportSize = T)
, reportSize = TRUE)
}

#' @rdname parcats-shiny
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The Htmlwidgets cannot be embedded in the `README.md` file. Check out the [Live

### Parcats from alluvial from data in wide format

```{r eval = F}
```{r eval = FALSE}
p = alluvial_wide(mtcars2, max_variables = 5)
parcats(p, marginal_histograms = TRUE, data_input = mtcars2)
Expand All @@ -94,7 +94,7 @@ Machine Learning models operate in a multidimensional space and their response i
Here we see the response of a random forest model if we vary the three variables with the highest importance while keeping all other features at their median/mode value.


```{r eval = F}
```{r eval = FALSE}
df = select(mtcars2, -ids )
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance
Expand Down
4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Re-Re-Re Submission
* Shortened title to less than 65 characters
* replaced all occurrences of F/T with FALSE/TRUE

## Re-Re Submission
Fixed Spelling
* highlightling --> highlighting
Expand Down
36 changes: 18 additions & 18 deletions docs/articles/parcats.html

Large diffs are not rendered by default.

Loading

0 comments on commit bc90b5f

Please sign in to comment.