NOTE: This is a toy package created for the purpose going through the package creation process. It is not meant to be terribly useful in its current form. Includes a vignette, license, tests, and a build status.
This package contains functions for to calculate the hypotenuse, perimeter, and area of 'rtriangle' class objects. It also creates 'rtriangle' class objects.
devtools::install_github("nadasal/rtriangle")
library(rtriangle)
Converting to an 'rtriangle' class object with rtriangle()
:
x <- rtriangle(3, 4)
class(x)
#> [1] "rtriangle"
calculating the hypotenuse of the triangle using hypotenuse()
:
hyp <- hypotenuse(x)
print(hyp)
#> [1] 5
calculating the perimeter of the triangle using perimeter()
:
peri <- perimeter(x)
print(peri)
#> [1] 12
calculating the area of the triangle using area()
:
area <- area(x)
print(area)
#> [1] 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.