Your "length" object is a factor
:
As the error message indicates, strsplit
expects a character vector as the input.
Try:
strsplit(as.character(length), ",")
Demo
x <- factor(c("1,2", "3,4", "5,6"))
strsplit(x, ",")
# Error in strsplit(x, ",") : non-character argument
strsplit(as.character(x), ",")
# [[1]]
# [1] "1" "2"
#
# [[2]]
# [1] "3" "4"
#
# [[3]]
# [1] "5" "6"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…