diagram_to_df | R Documentation |
The output of homology calculations from the R packages TDA and TDAstats are not dataframes. This function converts these outputs into a data frame either for further usage in this package or for personalized analyses.
diagram_to_df(d)
d |
the output of a TDA/TDAstats homology calculation, like ripsDiag or |
If a diagram is constructed using a TDA function like ripsDiag with the 'location' parameter set to true then the return value will ignore the location information.
a 3-column data frame, with each row representing a topological feature. The first column is the feature dimension (a non-negative integer), the second column is the birth radius of the feature and the third column is the death radius.
Shael Brown - shaelebrown@gmail.com
if(require("TDAstats"))
{
# create a persistence diagram from a 2D Gaussian
df = data.frame(x = rnorm(n = 20,mean = 0,sd = 1),y = rnorm(n = 20,mean = 0,sd = 1))
# compute persistence diagram with calculate_homology from package TDAstats
phom_TDAstats = TDAstats::calculate_homology(mat = df,dim = 0,threshold = 1)
# convert to data frame
phom_TDAstats_df = diagram_to_df(d = phom_TDAstats)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.