pckghw4g5
which contains the 3 following functions:This website is done for the HW4.
library(pkghw4g5)
As stated earlier, this function returns the area and the points to be able to then plot it, here we only use 10 points for readability :
estimate_area(10)
The estimated_area returned by the function is then computed using the following formula : $$ Blue Surface = ((Total points-Blue points)/Total points)*Box Surface $$
We can then plot the results of estimate_area()
through plot_area()
as follows :
x <- estimate_area(B= 5000, seed = 10) plot_area(x)
This function is used to open the shiny app that will let you play around with numbers, you can simply use the following code to have the shiny app :
runDemo()
This will then open the following shiny app :
{width=100%}
Where you then can change the seed so the generation of the points will be different, and use the slider to select the amount of points you would want to have the function running on.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.