In the seventh part of our series we are going to learn about the features of some interesting types of charts. More specifically we will talk about Table, Org Chart and Tree Map.
Read the examples below to understand the logic of what we are going to do and then test yous skills with the exercise set we prepared for you. Lets begin!
Answers to the exercises are available here.
As you already know, the first thing you have to do is install and load the googleVis package with:
NOTE: The charts are created locally by your browser. In case they are not displayed at once press F5 to reload the page.
It is quite simple to create a Table with googleVis. We will use the “Stock” dataset.
Look at the example below to create a simple table:
TableC <- gvisTable(Stock)
Create a list named “TableC” and pass to it the “Stock” dataset as a table. HINT: Use
Plot the the table. HINT: Use
Table with pages
To add pages to your table use:
Add pages to the table you just created and plot it. HINT: Use
It is quite simple to create an Org Chart with googleVis. We will use the “Regions” dataset. You can see the variables of your dataset with
Look at the example below to create a simple Org Chart:
OrgC <- gvisOrgChart(Regions )
Create a list named “OrgC” and pass to it the “Regions” dataset as an org chart. HINT: Use
Plot the the org chart. HINT: Use
You can adjust the dimensions of the org chart with these options:
Adjust the dimensions of your org chart. Set
height to 300,
width to 550 and
size to medium and plot it.
It is quite simple to create a Tree Map with googleVis. We will use the “Regions” dataset.
Look at the example below to create a simple Tree Map:
TreeC <- gvisTreeMap(Regions)
Create a list named “TreeC” and pass to it the “Regions” dataset as an org chart. HINT: Use
Plot the the tree map. HINT: Use
You can decide tha dependents variables of your dataset by selecting it. In the example above the dependent variable was “Val”. To choose “Fac” follow the example:
TreeC <- gvisTreeMap(Regions,
Set “Fac” as your dependent variable, plot the tree map and see the difference.
Obviously you can change the font size of your tree map simply with:
Set the size of your
font to 20 and plot your tree map. HINT: Use