show_typehints {typehint}R Documentation

Type hints - Automatic checks of function arguments

Description

Prints out the type hint restrictions for a function in the R console, based on the type hint comments within the function' body.

Usage

show_typehints(fun, color = "#bd0245")

Arguments

fun

The function of which the type hint checks will be shown.

color

Color of the output in standard hex RGB format, default is #bd0245.

Value

No return value, only output in the R console.

See Also

Other typehint: check_types(), typehint

Examples


celsius_to_fahrenheit <- function(degrees_celsius) {
 #| degrees_celsius numeric dim(1) not(NA, NULL)

 if(check_types()) return(degrees_celsius * 9/5 + 32)
 else return(NA)

}

show_typehints(celsius_to_fahrenheit)


[Package typehint version 0.1.2 Index]