I have following logistic regression model. I have written the log likelihood function and score function. but now i am confused how to calculate the score vector.

mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")

## view the first few rows of the data

head(mydata)

mydata$rank <- factor(mydata$rank)

mylogit <- glm(admit ~ gre + gpa + rank, data = mydata, family = "binomial")

summary(mylogit)

loglikfn <- function(b, y, X, o=0){

mu <- exp(o+X%*%b)
t(y)%*%X%*%b - sum(mu)

}

scorefn <- function(b, y, X, o=0){

mu <- exp(o+X%*%b)
t(y-mu)%*%X

}