Skip to contents

Usage like class(x) == "character" is prone to error since class in R is in general a vector. The correct version for S3 classes is inherits(): inherits(x, "character"). Often, class k will have an is. equivalent, for example is.character() or




Similar reasoning applies for class(x) %in% "character"

See also

linters for a complete list of linters available in lintr.