Automating backward or forward elimination of features for a multiple linear regression problem



Trying to replicate the code in python found here and here

Using GLM package to fit the model
Was able to store the P values inside a variable by using the method described here

Question is how do you access the column name in the formula by using indexes.

Example - my formula is @formula(Price~ Size+ Location+ Rooms)
where by csv file contains data with columns names Size, Location, Rooms and Price

I wanted something like @formula(4~ 1+ 2+ 3)

Is this possible ?