Since widyr has two distance based functions, namely pairwise_delta and pairwise_dist, I was wondering if we can take it a step further and add functionality for the data analyst/scientist to scale these pairwise distances to k dimensions. This is done in base R using cmdscale that takes a distance matrix and returns a matrix with each item as a row and each of the k dimensions as columns. The points are calculated such that the distance is maintained.
Now, this method returns a warning because of column_to_rownames() that I would like to get rid of. I'm searching for one but wanted to know your thoughts before I submit a PR.
Since
widyr
has two distance based functions, namelypairwise_delta
andpairwise_dist
, I was wondering if we can take it a step further and add functionality for the data analyst/scientist to scale these pairwise distances to k dimensions. This is done in base R usingcmdscale
that takes a distance matrix and returns a matrix with each item as a row and each of the k dimensions as columns. The points are calculated such that the distance is maintained.Example:
In the tidy, widy way, I figured the following way to do this when we have a distance based result from a widyr method:
This can be used for something like this:
Now, this method returns a warning because of
column_to_rownames()
that I would like to get rid of. I'm searching for one but wanted to know your thoughts before I submit a PR.