sampledata - readcsv属水平综合csv header = TRUErownames = 1sampledata - tsampledatasampledata - asdataframesampledatasampledataisnasampledata - 0envdata - readcsvCGDcsv header=TRUErownames = 1envdata - ten
The error "Error in mde(x) : 'list' object cannot be coerced to type 'double'" is occurring because the input data frame cor_df is not in the correct format for creating an adjacency matrix.
To fix this error, you can try converting the data frame to a matrix using the as.matrix() function before creating the graph. Here's an updated code snippet:
# Convert data frame to matrix
cor_matrix <- as.matrix(cor_df)
# Create graph
df_igraph <- graph_from_adjacency_matrix(cor_matrix, mode = "undirected", weighted = TRUE, diag = FALSE)
Make sure to use the updated cor_matrix variable when creating the graph. This should resolve the error and allow you to create the weighted undirected graph using the igraph package
原文地址: https://www.cveoy.top/t/topic/iFsf 著作权归作者所有。请勿转载和采集!