You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would use either read.table from the utils package or one of the read_* functions from the readr package. The exact function you use will depend on the format of your external data file. For instance, if you have a CSV, you would use one of the following blocks of code:
# code block using base R
library(TDAstats)
# read in data (change my_file.csv to your actual file name)input_data<- read.csv("/home/linda/Desktop/file/my_file.csv")
# select the columns of interest and store in a new data framedf_data<-input_data[, c("x", "y", "z")]
# convert that data frame to a numeric matrixmat_data<- as.matrix(df_data)
# calculate persistent homologyhomology_output<- calculate_homology(mat_data)
# code block using tidyverse
library(tidyverse)
library(TDAstats)
# read in data (change my_file.csv to your actual file name)input_data<- read_csv("/home/linda/Desktop/file/my_file.csv")
# select the numeric columns of interest, convert to a matrix, and calculate persistent homologyhomology_output<-input_data %>%
select(x, y, z) %>%
as.matrix() %>%
calculate_homology()
Dear All,
Please how do I read data from and external file to obtain the persistence homology:
The file has 4 columns: x y z. and it is in a certain directory let's say /home/linda/Destop/file.
Thank you!
The text was updated successfully, but these errors were encountered: