I have preprocessed a list of text documents using tm. Then I have created the DTM. Then I have transformed the DTM in a matrix like this:
t1 t2 t3 t4 t5 t6
A 0 0 1 5 3 1
B 1 3 5 3 2 2
C 3 0 6 0 0 0
D 1 2 0 0 0 0
where t1, t2, t3, t4, t5, t6 are words, A,B,C,D are the documents and the numbers inside the matrix are the frequecies of each word in each document.
I have then used the dist function of proxy package to calculate the Manhattan distance between the items A,B,C,D of the matrix.
This function compare and returns the distances between all the items A,B,C,D (all combinations).
Is there a way to calculate the distance (Manhattan, Euclidean) between only one specific item and all other? For example the distance between A and all other documents (B, C and D) without calculating the distances between all other documents?
I'm requiring an example code with the explanation of each passage.
Thank you.
I am PhD in mathematics.
I've got 9 courses of Data science specialization at Coursera (Data Science Tools, R programming, Getting and cleaning data, Exploratory data analysis, Reproducible research, Statistical inference, Regression models, Machine learning and Developing data products) with distinction.
Examples of my projects in R:
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]