Description Usage Arguments Examples
Plot D3partitionR object
1 2 3 |
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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)
|
Loading required package: titanic
Loading required package: data.table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.