# Cannot add 'brmsprior' objects to the prior

**URL:** <https://discourse.mc-stan.org/t/cannot-add-brmsprior-objects-to-the-prior/23053>\
**Category:** Modeling\
**Created:** [June 16, 2021, 4:05pm UTC](https://discourse.mc-stan.org/t/cannot-add-brmsprior-objects-to-the-prior/23053 "2021-06-16T16:05:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rccline](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/rccline/32/12000_2.png) [@rccline](https://discourse.mc-stan.org/u/rccline)\
**Post date:** [June 16, 2021, 4:05pm UTC](https://discourse.mc-stan.org/t/cannot-add-brmsprior-objects-to-the-prior/23053/1 "2021-06-16T16:05:22Z")

</div>

I am in a class and the instructor has provided the following code and attached data.

```
library(brms)
fit_press <- brm(rt ~ 1,
                 data= df_spacebar,
                 family = gaussian(),
                 prior = c(
         
[df_spacebar.csv|attachment](upload://xHuLcXdeRWcfp7HqiKlfXMRAbJk.csv) (5.1 KB)
          prior(uniform(0, 60000), class = Intercept),
                   prior(uniform(0, 2000, class = sigma)
                        ),
                   chains = 4, 
                   iter = 2000,
                   warmup = 1000
                 ))

```

When I run the code, I get an error: “Cannot add ‘brmsprior’ objects to the prior.”  
I am the only one in the class who gets the error.

**My reprex**

fit\_press ← brm(rt ~ 1,  
data= df\_spacebar,  
family = gaussian(),  
prior = c(  
prior(uniform(0, 60000), class = Intercept),  
prior(uniform(0, 2000, class = sigma)  
),  
chains = 4,  
iter = 2000,  
warmup = 1000  
))  
#\> Error in brm(rt ~ 1, data = df\_spacebar, family = gaussian(), prior = c(prior(uniform(0, : could not find function “brm”

If I remove the priors, i.e. “prior = c(…),” The code runs.

Any ideas about what is happening? Why is adding priors “hiding” brm function? Or, is it something else?

Thank you.

---

<div class="post-metadata">

**Author:** ![jd\_c](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jd_c/32/16759_2.png) [@jd\_c](https://discourse.mc-stan.org/u/jd_c)\
**Post date:** [June 16, 2021, 4:20pm UTC](https://discourse.mc-stan.org/t/cannot-add-brmsprior-objects-to-the-prior/23053/2 "2021-06-16T16:20:43Z")

</div>

It looks like maybe you are missing a ‘)’ after the ‘2000’ in your second prior() statement.

---

<div class="post-metadata">

**Author:** ![rccline](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/rccline/32/12000_2.png) [@rccline](https://discourse.mc-stan.org/u/rccline)\
**Post date:** [June 16, 2021, 4:26pm UTC](https://discourse.mc-stan.org/t/cannot-add-brmsprior-objects-to-the-prior/23053/3 "2021-06-16T16:26:18Z")

</div>

You’ve got eyes like an eagle. Thank you very much.
