asInteger is intended to be used for vectors while asInt isa specialization for scalar integers and asCount for scalarnon-negative integers.Convertible are (a) atomic vectors with all elements NAand (b) double vectors with all elements being within tolrange of an integer.

You are watching: A numeric or double convertible argument is expected

Note that these functions may be deprecated in the future.Instead, it is advised to use assertCount,assertInt or assertIntegerish withargument coerce set to TRUE instead.

asInteger( x, tol = sqrt(.Machine\$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, .var.name = vname(x))asCount( x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine\$double.eps), .var.name = vname(x))asInt( x, na.ok = FALSE, lower = -Inf, upper = Inf, tol = sqrt(.Machine\$double.eps), .var.name = vname(x))

## Arguments

x tol lower upper any.missing all.missing len min.len max.len unique sorted names .var.name na.ok positive
 Object to convert. Numerical tolerance used to check whether a double or complex can be converted.Default is sqrt(.Machine\$double.eps). Lower value all elements of x must be greater than or equal to. Upper value all elements of x must be lower than or equal to. Are vectors with missing values allowed? Default is TRUE. Are vectors with no non-missing values allowed? Default is TRUE.Note that empty vectors do not have non-missing values. Exact expected length of x. Minimal length of x. Maximal length of x. Must all values be unique? Default is FALSE. Elements must be sorted in ascending order. Missing values are ignored. Check for names. See checkNamed for possible values.Default is “any” which performs no check at all.Note that you can use checkSubset to check for a specific set of names. Name of the checked object to print in error messages. Defaults tothe heuristic implemented in vname. Are missing values allowed? Default is FALSE. Must x be positive (>= 1)?Default is FALSE.

## Details

This function does not distinguish betweenNA, NA_integer_, NA_real_, NA_complex_NA_character_ and NaN.

## Examples

asInteger(c(1, 2, 3))#> <1> 1 2 3asCount(1)#> <1> 1asInt(1)#> <1> 1