Hi Chris,
I am working through Chapter 6 of the user guide and following the complete example script provided in section 6.1.1. I am running into an issue at Step 4 with the make_brainGraphList command: I am wondering if you know of the work around for the edges argument being deprecated?
> # 4. Create graph lists and calculate graph metrics
> g <- lapply(seq_along(densities), function(x)
+ make_brainGraphList(corrs[x], atlas ='dk', modality='thickness'))
[1] "Start time: 2024-04-17 15:00:47"
| | 0%Error in { :
task 2 failed - "The `edges` argument of `as_adjacency_matrix()` was deprecated in igraph 2.0.0 and is now defunct."
The rest of my code is below:
```{r}
# 1. Import data & set up variables
datadir <- "~//neuroimaging//Connectome_project"
covars <- fread(file.path(datadir, 'covars.csv'), stringsAsFactors=FALSE)
covars$meets_ptsd_criteria <- as.factor(covars$meets_ptsd_criteria)
grps <- covars[, levels(meets_ptsd_criteria)]
options(bg.group='meets_ptsd_criteria')
exclude.subs <- c('98', '99')
raw_data <- import_scn(datadir, atlas='dk', modality='thickness',
exclude.subs=exclude.subs)
# A hack to get the variables into the workspace
invisible(lapply(seq_along(raw_data), function(x)
assign(names(raw_data)[x], eval(raw_data[[x]]), envir=.GlobalEnv)))
# 2. Get and check residuals
myResids <- get.resid(lhrh, covars=covars, exclude.cov='meets_ptsd_critera')
residPlots <- plot(myResids)
ml <- gridExtra::marrangeGrob(residPlots, nrow=3, ncol=3)
ggsave('residuals.pdf', ml, path = datadir)
system('xdg-open residuals.pdf')
# 3. Correlation matrices
densities <- seq(0.05, 0.20, 0.01)
corrs <- corr.matrix(myResids, densities=densities)
# 4. Create graph lists and calculate graph metrics
g <- lapply(seq_along(densities), function(x)
make_brainGraphList(corrs[x], atlas ='dk', modality='thickness'))
# 5. data.tables of the metrics
dt.G <- rbindlist(lapply(g, graph_attr_dt))
dt.V <- rbindlist(lapply(g, vertex_attr_dt))
```
Thank you,
Sarah