The “is.finite” Function in R
Package: Base R (no specific package required)
Purpose: Checks if values are finite (i.e., not infinite or NaN).
General Class: Data Inspection
Required Argument(s):
x: An R object, typically a numeric vector, whose elements are checked for being finite.
Notable Optional Arguments:
None
Example:
# Example data for using the is.finite function
numeric_vector <- c(1, 2, Inf, 4, -Inf, NaN)
# Use is.finite to check for finite values in a numeric vector
finite_result <- is.finite(numeric_vector)
# Display the result
print(finite_result)In this example, the is.finite function is used to check for finite values in a numeric vector (numeric_vector). The resulting logical vector (finite_result) indicates TRUE for positions where the values are finite and FALSE where values are infinite or NaN. The is.finite function is commonly used for identifying and handling finite values in numerical data.