Couldn't find stan() in R witn Stan

I do Bayesian statistics programming in R with Stan, but the console couldn’t find the function “stan”. There is an error in the code

stanfit <- stan(file=scr, model_name=scr, data=data, pars=par, verbose=F,seed=see, chains=cha, warmup=war,iter=ite)

the whole code as follows.

library(rstan)
library(rstanarm)
library(loo)
library(bayesplot)
library(ggplot2)
options(mc.cores = paralles::detectCores())
scr <- "modelbeforeafter.stan"
source("databeforeafter.R") 
data <- list(N=N,xA=xA,xB=xB)
par <-c("muA","muB", "SigmaA","SigmaB","log_likA","log_likB","rhoA", "rhoB","deltaA","deltaB","es","deltaA_over","deltaB_over","es_over","delta_r","delta_r_over")
war <- 1000 
ite <- 11000 
see <- 1234 
dig <- 3 
cha <- 1 
stanfit <- stan(file=scr, model_name=scr, data=data, pars=par, verbose=F,seed=see, chains=cha, warmup=war,iter=ite)
loo1 <- rstan:::loo.stanfit

The function stan() is an exported object from the package rstan.

Please add

library(rstan)

into your code.

Thank you so much for answering my question, but the console could not find function stan, even though I write the code library(rstan). I have already loaded rstan package in R with stan.