I have already successfully obtained my list of i fitted ASR Regressions in the object ASR_fits. The code and dataset used "sample obs" can both be found in my GitHub Repository for this project, the script is called "EER script".
Here is my code in EER script:
# Load all libraries needed for this script.
# The library specifically needed to run a basic ASR is the 'leaps' library.
library(dplyr)
library(tidyverse)
library(stats)
library(leaps)
library(purrr)
directory_path <- "~/DAEN_698/sample obs"
filepath_list <- list.files(path = directory_path, full.names = TRUE, recursive = TRUE)
# reformat the names of each of the csv file formatted datasets
DS_names_list <- basename(filepath_list)
DS_names_list <- tools::file_path_sans_ext(DS_names_list)
datasets <- lapply(filepath_list, read.csv)
# code to run a normal All Subsets Regression
ASR_fits <- lapply(datasets, function(i)
regsubsets(x = as.matrix(select(i, starts_with("X"))),
y = i$Y, data = i, nvmax = 15,
intercept = TRUE, method = "exhaustive"))
ASR_fits_summary <- summary(ASR_fits)
From there, I have tried the following two lines which both worked fine when I did the same thing for BE & FS Regressions a few weeks ago:
ASR_Coeffs <- lapply(ASR_fits, function(i) coef(i))
ASR_Coeffs <- lapply(ASR_fits, function(i) coefficients(i))
But both of them give me the exact same error message, that error message is included below:
> ASR_Coeffs <- lapply(ASR_fits, function(i) coef(i))
Error in coef.regsubsets(i) : argument "id" is missing, with no default