I was using the Smarket Data in ISLR package for logistic regression (in R) and facing the below error:

If i am putting the below command i am getting the error(warning):

glm.fit1 = glm(Direction~. - Direction, data = Smarket, family = "binomial") Warning messages: 1: glm.fit: algorithm did not converge 2: glm.fit: fitted probabilities numerically 0 or 1 occurred

however if i am running this command, i am not seeing any error:

glm.fit=glm(Direction∼Lag1+Lag2+Lag3+Lag4+Lag5+Volume , + data=Smarket ,family =binomial )

Although both the commands looks same to me(excluding the Direction)

and 2nd finding:

the output are also different in both the cases.

So, my questions are

1) Why i am getting the warning if both the commands are same. 2) why the output is also different.

Thanks for the help.