Converts object to certain type, preserving the NULL value.

as.type_or_null(x, as.type)

Arguments

x

Object to cast.

as.type

A casting function for x

Value

x casted, or NULL.