is.integer()
R語言中的函數用於檢查作為參數傳遞給它的對象是否為整數類型。
用法: is.integer(x)
參數:
x:檢查對象
範例1:
# R program to check if
# object is an integer
# Creating a vector
x1 <- 4L
x2 <- c(1:6)
x3 <- c("a", "b", "c", "d")
x4 <- c(1, 2, "a", 3, "b")
# Calling is.integer() function
is.integer(x1)
is.integer(x2)
is.integer(x3)
is.integer(x4)
輸出:
[1] TRUE [1] TRUE [1] FALSE [1] FALSE
範例2:
# R program to check if
# object is an integer
# Creating a matrix
x1 <- matrix(c(1:9), 3, 3)
# Calling is.integer() function
is.integer(x1)
輸出:
[1] TRUE
相關用法
- R語言 type.convert()用法及代碼示例
- R語言 as.integer()用法及代碼示例
- R語言 is.character()用法及代碼示例
- R語言 is.character()用法及代碼示例
- R語言 is.numeric()用法及代碼示例
- R語言 is.complex()用法及代碼示例
- R語言 mode()用法及代碼示例
- R語言 is.matrix()用法及代碼示例
- R語言 is.list()用法及代碼示例
- R語言 exists()用法及代碼示例
- R語言 is.vector()用法及代碼示例
- R語言 is.call()用法及代碼示例
- R語言 is.table()用法及代碼示例
- R語言 is.expression()用法及代碼示例
- R語言 is.unsorted()用法及代碼示例
- R語言 sapply()用法及代碼示例
- R語言 typeof()用法及代碼示例
- R語言 strtoi()用法及代碼示例
- R語言 utf8ToInt()用法及代碼示例
- R語言 intToUtf8()用法及代碼示例
- R語言 intToBits()用法及代碼示例
- R語言 as.binary()用法及代碼示例
- R語言 is.primitive()用法及代碼示例
注:本文由純淨天空篩選整理自nidhi_biet大神的英文原創作品 Check if an Object is of Type Integer in R Programming – is.integer() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。