Dear Chris,
I am referencing the complete code block on page 35 of the user guide in order to do structural covariance network analysis. I am using the DK atlas and cortical thickness, and brainGraph version 3.0.2 and R version 4.1.2 I have been able to successfully import the data and variables using the following code:
datadir <- /home/rstudio/braingraphfiles
raw_data <- import_scn(datadir, atlas='dk', modality='thickness')
invisible(lapply(seq_along(raw_data), function(x)
assign(names(raw_data)[x], eval(raw_data[[x]]), envir=.GlobalEnv)))
covars <- fread(file.path(/home/rstudio/braingraphfiles, 'covars.csv'))
grps <- covars[, levels(factor(Group))]
I am running into an error trying to get the residuals. When I run the following line: myResids <- get.resid(lhrh, covars=covars, exclude.cov='Group') I receive an error that says: Error in X %*% beta : non-conformable arguments.
My covars data frame contains 2,603 observations and 8 variables while my lhrh data frame contains 2,603 observations and 69 variables.
From my understanding, this error is usually a matrix multiplication error, so I tried to transpose the covars file so the number of columns in one df matched the number of rows in the other. I also temporarily altered the lhrh df to have 8 variables and exactly match the dimensions of the covars df. However I am still receiving the same error.
What do you advise to address this error?
Thank you so much,
Sara