Converts valid objects to PHom instances.

as.PHom(x, dim_col = 1, birth_col = 2, death_col = 3)

Arguments

x

object being converted to PHom instance

dim_col

either integer representing column index for feature dimension data or character representing column name

birth_col

either integer representing column index for feature birth data or character representing column name

death_col

either integer representing column index for feature death data or character representing column name

Value

PHom instance

Examples

# construct data frame with valid persistence data
df <- data.frame(dimension = c(0, 0, 1, 1, 1, 2),
                 birth = rnorm(6),
                 death = rnorm(6, mean = 15))

# convert to `PHom` instance and print
df_phom <- as.PHom(df)
df_phom
#> PHom object containing persistence data for 6 features.
#> 
#> Contains:
#> * 2 0-dim features
#> * 3 1-dim features
#> * 1 2-dim feature
#> 
#> Radius/diameter: min = -1.863; max = 15.738.

# print feature details to confirm accuracy
print.data.frame(df_phom)
#>   dimension       birth    death
#> 1         0  2.06502490 15.54300
#> 2         0 -1.63098940 14.08593
#> 3         1  0.51242695 15.46815
#> 4         1 -1.86301149 15.36295
#> 5         1 -0.52201251 13.69546
#> 6         2 -0.05260191 15.73778