2013-04-02 5 views
0

에 나는 cluto 형식의 문서 행렬 (matrix)이란 용어가?CLUTO 문서 기간 매트릭스 TM의 DocumentTermMatrix

Cluto File: 
2 3 3 
1 3 3 4 
2 8 

Row File: 
car 
plane 

Column File: 
x 
y 
z 

해결 방법 :

dtm = as.DocumentTermMatrix(read_stm_CLUTO(file), weightTf); 
rows <- scan("rows.txt", what="", sep="\n"); 
columns <- scan("columns.txt", what="", sep="\n"); 

dtm$dimnames = list(rows,columns); 
+1

어때요? '요구하다 (슬램); .DocumentTermMatrix (read_stm_CLUTO (file), weightTf)' – Ben

+0

@Ben Perfect, 답으로 입력 해 주시면 받아 들일 수 있습니까? 행과 열 이름을 전달하는 방법이 있습니까? – metdos

답변

1

이 그것을 수행해야합니다

require(slam) 
as.DocumentTermMatrix(read_stm_CLUTO(file), weightTf) 

을 당신이 당신의 CLUTO 파일에 연결하거나 우리가 볼 수있는 Q에의 발췌를 추가 할 수 있습니다 행 및 열 이름.

모자 - 팁 : https://r-forge.r-project.org/scm/viewvc.php/pkg/R/foreign.R?root=tm&view=diff&r1=1127&r2=1127&diff_format=s

+0

예제를 추가 – metdos

+0

col/row 이름을 정렬 한 것처럼 보입니다. 'dtm $ dimnames = list (Docs = rows, Terms = columns)'라고 할 수 있습니다. – Ben