identity()R语言中的函数用于打印作为参数传递给它的对象的值。
用法: identity(x)
参数:
x:一个东西
范例1:
# R program to print
# the value of an object
# Creating a vector
x <- c(1, 2, 3, 4)
# Creating a list
list1 <- list(letters[1:6])
# Calling the identity function
identity(x)
identity(list1)输出:
[1] 1 2 3 4 [[1]] [1] "a" "b" "c" "d" "e" "f"
范例2:
# R program to print
# the value of an object
# Calling predefined data frame
x1 <- BOD
# Creating a matrix
mat <- matrix(c(1:9), 3, 3, byrow = T)
# Calling the identity() Function
identity(x1)
identity(mat)输出:
Time demand
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8
[, 1] [, 2] [, 3]
[1, ] 1 2 3
[2, ] 4 5 6
[3, ] 7 8 9
相关用法
- R语言 charToRaw()用法及代码示例
- R语言 deg2rad()用法及代码示例
- R语言 rad2deg()用法及代码示例
- R语言 print()用法及代码示例
- R语言 sapply()用法及代码示例
- R语言 type.convert()用法及代码示例
- R语言 which()用法及代码示例
- R语言 call()用法及代码示例
- R语言 cumprod()用法及代码示例
- R语言 is.character()用法及代码示例
- R语言 ncol()用法及代码示例
- R语言 is.factor()用法及代码示例
- R语言 nrow()用法及代码示例
- R语言 unique()用法及代码示例
- R语言 max()用法及代码示例
- R语言 min()用法及代码示例
- R语言 str()用法及代码示例
- R语言 cumsum()用法及代码示例
- R语言 get()用法及代码示例
- R语言 order()用法及代码示例
- R语言 rowMeans()用法及代码示例
- R语言 names()用法及代码示例
- R语言 as.list()用法及代码示例
注:本文由纯净天空筛选整理自nidhi_biet大神的英文原创作品 Print the Value of an Object in R Programming – identity() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
