Use of garson() and olden()

Hi there!
I am having trouble using the garson() and olden() functions, the first one for example can be found here:

https://www.rdocumentation.org/packages/NeuralNetTools/versions/1.5.2/topics/garson
Since I need to program an AI first before using the functions on it, I need enough data rows, so that the function train() does not complain before we even get to the actual problem. Therefore I have quite a few data rows.

library(caret)
library(NeuralNetTools)

DoseTrack.prepared <- read.csv(
  "C:/Changed.csv")
  
KI <- train(
    x = as.data.frame(subset(DoseTrack.prepared, select=-c(`CTDIVol..mGy.`))),
    y = DoseTrack.prepared$`CTDIVol..mGy.`,
    method = "nnet",
    preProc = c("center", "scale"),
    trControl = trainControl(
      search = "random",
      allowParallel = TRUE,
      savePredictions = "final"
    ),
    tuneLength = 1,
    maxit = 500,
    MaxNWts = 5000,
    linout = TRUE,
    trace = TRUE
  )
garson(KI)
olden(KI)

The file needed for the read.csv function can (hopefully) be found here:
https://github.com/DanielRSt/R-File
I am new to Github, however, so I hope the download of the file is publicly available. I have changed the data from the Original to censor, hence the name "Random" and the weird distribution of digits within the data frame, in case anyone is wondering. The type of data within each column remains the same, however. Make sure to change the code line

"C:/Changed.csv"

according to your save location.

The error, translated from german, is
"Error in strsplit(as.character(mod_in$terms[[2]]), " + ", fixed = TRUE)[[1]] :
Indexing out of bounds."

Any ideas on fixes?

You probably need to use

garson(KI$finalModel)

and same for the other function.

Thank you for your help!

The first time I tried your solution, I was able to read the importance of the variables in the Data Segment within a vector-like data structure, that was generated. After restarting my laptop the day after, weirdly, that did not work anymore. The only thing I could do was looking at the given graphic, and try to extract the values from there. However, the description of the bars overlap. Any ideas on fixes? And potentially any ideas on why I used to be able to look at the values within this kind of vector, and now I have to use the graphic for this? The code did not change and is still given in my other post. Maybe changes in the global environment?

The docs for garson() has

A ggplot object for plotting if bar_plot = FALSE , otherwise a data.frame of relative importance values for each input variable. The default aesthetics for ggplot can be further modified, as shown with the examples.

Maybe you are setting one of the options differently?

Thank you, using bar_plot did work to get the values in a vector. I suspect for changing the names of the variables on the x-axis in the diagram I need to use x_lab, as mentioned in
https://www.rdocumentation.org/packages/NeuralNetTools/versions/1.5.2/topics/garson
Just how to declare it properly? Something like
x_lab=(a,b,c,...) or x_lab=("a","b","c",...) or x_lab=(1,2,3,...) won't work.