【发布时间】:2019-01-11 18:57:46
【问题描述】:
考虑以下代码:
library(PST)
library(TraMineR)
library(RCurl)
x <- getURL("https://gist.githubusercontent.com/aronlindberg/c79be941bc86274f4526705600962789/raw/6e3ee8d464c97f1c26631d604de41ca97dc22159/sequence_data.csv")
data <- read.csv(text = x)
data.seq <- seqdef(data[,2:ncol(data)], missing = "%")
pstree(data.seq)
这会生成以下错误消息:
Error in names(StCol) <- A : attempt to set an attribute on NULL
我看不出这会产生错误的任何原因。该数据适用于多个TraMineR 函数,例如
seqient(data.seq)
此错误消息的原因是什么?我该如何克服它?
【问题讨论】:
-
StCol是pstree使用的调色板。发生该错误的原因可能是您没有为data.seq对象分配调色板,该对象具有 12 个以上的状态。尝试使用seqdef的cpal参数分配一个。