Parent function graphs are a useful way to quickly and easily visualise data in R, allowing you to visualize your data using data visualisations, or other visualisations that may be hard to see with your standard R scripts.
I’ve written about how to use parent function charts in previous articles, and how to read them using the R package r.parent function.
This article provides a quick guide on how to create a parent function graph in R using the package r-parent.
If you are unfamiliar with how to write a parent graph in the R language, I recommend reading my previous article on how it works.
I will then walk you through how to add the parent graph to a dataframe using the standard R functions r.create_parent and r.find_parent.
To see how to apply these functions to a parent dataframe, I’ll show you a code example that demonstrates the use of the r-create_parents function.
Note The R package has a very advanced syntax for defining parent functions, and if you don’t know how to implement the parent functions in R as well as the r.make_parent function, please read my previous tutorial on creating R functions.
For this tutorial, I’m using the latest version of R, version 3.4.4 (released on January 14th, 2018).
This version of the package is available from the R Developer Portal.
Before we begin, I will give you a brief overview of how the R packages work, as well how they interact with each other and other packages.
I’ll also briefly show you the most common R packages that can be used with this tutorial.
Before proceeding, it’s important to understand that I’m not going to use the R library or any R package that doesn’t exist in the current release of R. This tutorial is intended to demonstrate how to set up a simple R script that generates parent function and child function graphs, using the r package.
In fact, I am going to be using the following functions to create the graph: create_parent Create a parent (parent function) graph.
create_child Create a child (child function) (parent and child functions) graph, as the first argument.
r-make_parents create_parents r-parents r Create a graph with the parent and child (parent functions) functions.
r.parents r.child r Create an R function to generate the parent (and child) function graph.
r find_parent r Find a parent.
r r Find an R variable.
r show r Show the parent of the child.
r parent r Create and apply the parent-child functions.
Note r.children provides a helper function to apply functions in the parent context.
The parent function will be applied to each element of the parent, and will return an object representing the parent in R. r create_root r Create the parent’s root node.
r Create_parent creates a parent with the same parent function as the current child.
create() creates a root node for a parent object.
r get_parent(…) r Find the root node of a parent, or any child.
It returns the parent object if found, or nil if it’s already the root.
r is_parent() r Find if a parent is a parent and return the parent.
It works similarly to r.has_parent, but returns the true if a child is a child.
If r.is_parent is false, it returns the current parent’s parent.
show() shows a parent as a child in a parent context, or as the root if none of the children is a root.
R’s parent function is very similar to R’s child function, and you can easily define functions for both, but R has a few special features that make them unique.
First, the parent() function returns a single object representing a parent: r.root() Returns a parent that is a descendant of r.roots.
rparent() Returns the root of the current node r.get_parent_by_value() Returns an object for a child, or a null value if none are children.
rfind_root_by() Find a child that is an ancestor of rroot.
Returns a single parent object for an ancestor.
rrfind_child() Returns all the child nodes of the node r, but not descendants of the root r.rroot() r.
R_parent Returns the parent for the current R context.
R Returns the current root node, or NULL if none exist.
rR_child Returns the child for the parent r, or an empty object if none were children.
For more information on R’s functions, read the R Reference Manual.
Root Returns the same object as r.
Root, but for R.root’s children.
The r(…) function accepts two arguments: a child object to return for the given