O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In the preceding treemap, we passed both categorical variables through the index attribute, but sometimes you need require to pass both categorical and numerical variables to gather better information about the hierarchical structure of the plot:

> post_data=read.csv("post-data.csv")> treemap(post_data,index=c("category", "comments"),vSize="views",type="index" )

The following is the treemap plot generated from the preceding command:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required