show_typehints: Type hints - Automatic checks of function arguments

Description Usage Arguments See Also Examples

View source: R/typehint.r

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

1
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.

See Also

Other typehint: check_types(), typehint

Examples

1
2
3
4
5
6
7
8
9
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)

jsugarelli/typehint documentation built on Dec. 21, 2021, 3:22 a.m.