2017-08-06 8 views
0
# 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)], ]))) 
+0

あなたは、再現性の例を作ることができますか? –

答えて

0

は()の代わりに、完全なマトリックスのサンプルを表示します。完全密な表現は、as.matrix()を介して利用できます。

# This will give you the entire matrix, from here you can filter it as you want 
as.matrix(Nepal.tdm) 
関連する問題