pkgdown
area {pkghw4g6}
pkghw4g6 allows to estimate the area of a shape and plot the shape S in two steps. This package requires the packages stats and ggplot2.
First, it uses a function estimate_area() that takes two arguments:
This function simulate B coordinates and stores them in a data frame of three columns: x, y and inside in which the third column indicates whether data points lie within the shape's limits or not (TRUE or FALSE).
The shape S is delimited by three constraints:
Once the data points are simulated and have a logical value (TRUE or FALSE) assigned, the function returns the estimated return value (i.e. area of the shape) by summing up all TRUE values and divide it by the total number of simulated data points B. The return value is stored in a list containing the returned estimated values and all data points.
Then, it uses a second function plot_area() to plot the shape and the data points. This function uses the ggplot2 package and its ggplot() function to plot the shape constraints, B data points.
The plot object returns a graph with a one-by-one frame around B simulated data points and a shape drawn using the three constraints listed above. Data points are either in red within the limits of the shape or in blue outside the shape.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.