I have a large data set and like to fit different logistic regression for each City, one of the column in my data. The following 70/30 split works without considering City g
Your code works just fine as is, if City is a column, simply run training data as train[,2]. You can do this easily for each one with a lambda function