Learn R Programming

D3partitionR (version 0.5.0)

plot.D3partitionR: Plot D3partitionR object

Description

Plot D3partitionR object

Usage

# S3 method for D3partitionR
plot(x, width = NULL, height = NULL,
  elementId = NULL, sizingPolicy = NULL, ...)

Arguments

x

A D3partitionR object to plot

width

width of the widget in pixel/percent

height

height of the widget in pixel/percent

elementId

html id of the widget

sizingPolicy

sizing policy

...

parameters for method consistency

Examples

Run this code
# NOT RUN {
require(titanic)
require(data.table)
## Reading data
titanic_data = data.table(titanic::titanic_train)

##Agregating data to have unique sequence for the 4 variables
var_names=c('Sex','Embarked','Pclass','Survived')
data_plot=titanic_data[,.N,by=var_names]
data_plot[,(var_names):=lapply(var_names,function(x){data_plot[[x]]=paste0(x,' ',data_plot[[x]])
})]

## Plotting the chart
library("magrittr")
d3=D3partitionR() %>%
 add_data(data_plot,count = 'N',steps=c('Sex','Embarked','Pclass','Survived')) %>%
 add_title('Titanic')
# }
# NOT RUN {
plot(d3)
# }

Run the code above in your browser using DataLab