plot.D3partitionR {D3partitionR} | R Documentation |
Plot D3partitionR object
Description
Plot D3partitionR object
Usage
## S3 method for class '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
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)
## End(Not run)
[Package D3partitionR version 0.5.0 Index]