Help with Argument Matching Multiple Formal Arguments

Looking to use the regsubsets function but I keep getting this error message:
Error in regsubsets.formula(SalePrice ~ OverallQual + OverallCond + Years_Since_Remodel + :
argument 3 matches multiple formal arguments

#Trying subset method

library(leaps)
subset <- regsubsets(SalePrice ~ OverallQual + OverallCond + Years_Since_Remodel + GrLivArea + FullBath +
             Bedrooms + Total_Rooms + GarageArea + CentralAirI,  method="exhaustive" ,
          n = nrow(ST625_For_R)
,p= as.numeric(substr(rownames(summary(subset)$outmat) ,1,1)) +1
,table <- cbind(summary(subset)$outmat),
round(summary(subset)$rsq, 8),
round(summary(subset)$adjr2, 8),
round(summary(susbet)$rss/(n-p),8),
round(n*log(summary(subset)$rss) - n*log(n)+ 2*p,8),
round(n*log(summary(subset)$rss) - n*log(n) + log(n) *p,7))
colnames(table) = c(paste("x", 1:9, sep=""), "R2","R2-adj","MSE","AIC","BIC")
table

Please help, thank you! I've tried eliminating the variables one by one to see whats causing the problem but the error is still there.

The code is a little hard to follow but based on the documentation for that function, there is no argument n. There are three arguments that start with n: nbest, nvmax, and nested. Since R uses partial arg matching, your third argument to the function n matches multiple actual arguments and it doesn't know how to solve this ambiguity.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.