0
在下面显示的示例中,为什么将该因子视为数字而不是字符或因子?当用作列表索引/键时,将R因子转换为数字
myList <- list()
myList[["hello"]] <- 1
myList[["world"]] <- 2
myList[[factor("world")]] <- 3
输出:
$hello
[1] 3
$world
[1] 2
在下面显示的示例中,为什么将该因子视为数字而不是字符或因子?当用作列表索引/键时,将R因子转换为数字
myList <- list()
myList[["hello"]] <- 1
myList[["world"]] <- 2
myList[[factor("world")]] <- 3
输出:
$hello
[1] 3
$world
[1] 2