如何在R'中保存完整的检查输出;s tm包装,而不是尺寸为10*10的样品矩阵? #我的术语文档矩阵(TDM) 尼泊尔.tdm #我的TDM的结构 str(尼泊尔,tdm) #我的局部向量 地方 #我的局部向量的结构 str(地方) #chr[1:344]“kalyan”“surkhet”“chhinchu”“harre”“pyuthan”“thapdada”“khola”。。。 #检查我的TDM中的匹配位置 Location.matches

如何在R'中保存完整的检查输出;s tm包装,而不是尺寸为10*10的样品矩阵? #我的术语文档矩阵(TDM) 尼泊尔.tdm #我的TDM的结构 str(尼泊尔,tdm) #我的局部向量 地方 #我的局部向量的结构 str(地方) #chr[1:344]“kalyan”“surkhet”“chhinchu”“harre”“pyuthan”“thapdada”“khola”。。。 #检查我的TDM中的匹配位置 Location.matches,r,text-mining,tm,R,Text Mining,Tm,因为tm v.0.7 inspect.TermDocumentMatrix()显示的是一个样本而不是完整的矩阵。可通过as.matrix()获得完整的密集表示 你能举一个可复制的例子吗? # My TermDocumentMatrix (TDM) Nepal.tdm # Structure of my TDM str(Nepal.tdm) # My locality vector localities # Structure of my locality vector str(locali

因为tm v.0.7 inspect.TermDocumentMatrix()显示的是一个样本而不是完整的矩阵。可通过as.matrix()获得完整的密集表示


你能举一个可复制的例子吗?
# My TermDocumentMatrix (TDM)
Nepal.tdm

# Structure of my TDM
str(Nepal.tdm)

# My locality vector
localities

# Structure of my locality vector
str(localities)
#chr [1:344] "kalyan" "surkhet" "chhinchu" "harre" "pyuthan" "thapdada" "khola" ...

# inspecting matching localities in my TDM
locality.matches <- inspect(Nepal.tdm[localities[localities %in% Terms(Nepal.tdm)], ])    

# I have tried following things but without success because the output is always 10 * 10 sample matrix when I want complete matrix of 200 * 92
as.data.frame(as.matrix(inspect(Nepal.tdm[localities[localities %in% Terms(Nepal.tdm)], ])))

capture.output(out <- data.frame(inspect(Nepal.tdm[localities[localities %in% Terms(Nepal.tdm)], ])))
# This will give you the entire matrix, from here you can filter it as you want
as.matrix(Nepal.tdm)