0

I have two matrices:

features.dataf[,2:4] which is a dataframe:

   alliterationScore consonanceScore concretenessScore
1         0.09467456       0.8224852         0.5508414
2         0.10547173       0.7286084         0.5067937
3         0.09533538       0.6561117         0.5198898
4         0.07987313       0.6046713         0.5403059
5         0.08063471       0.7758822         0.5030544
6         0.07970548       0.7305108         0.5103972
7         0.08433789       0.7349316         0.5069280
8         0.07673948       0.7644853         0.4805814
9         0.07541599       0.8070555         0.4731516
10        0.06970208       0.7642246         0.4529096

and my_list[[1]] (which has a matrix inside):

 alliterationScore consonanceScore concretenessScore
1        0.08433789       0.7349316         0.5069280
2        0.09467456       0.8224852         0.5508414
3        0.08433789       0.7349316         0.5069280

When I take their pdist with this line:

> dv <- as.matrix(pdist(features.dataf[,2:4], my_list[[1]]))
> dv
     [,1]      
     "pdist"   
dist Numeric,30
n    10        
p    3         
> 

The resultant output is shown above. This seems to be quite wrong. In the past pdist has always given an output such that dv[i,j] should have had an output of the euclidean distance between the ith row vector of the first matrix and the jth row vector of the second matrix. However the result above just seems to be giving the row numbers of the two matrices. In my previous runnings of the same code it was giving the correct output that is a matrix of size iXj but there seems to be something going topsy-turvy this time. Could anyone please help me with detecting the issue?

QPTR
  • 1,620
  • 7
  • 26
  • 47
  • Oops, yeah, its the same. – QPTR May 24 '15 at 16:15
  • 1
    It works for me. Perhaps something else in your environment is clouding the issue? (Perhaps looking at `sessionInfo()` would be insightful?) – r2evans May 24 '15 at 16:18
  • Hmm, I'll try clearing up all the environment variables, but now that might take half an hour because the features.dataf is obtained after reading a huge text corpus :) When I use dummy values tho, it seems to give correct results. I guess I'll try again when the features matrix is ready. – QPTR May 24 '15 at 16:27

0 Answers0