0

I keeep getting this error every time I try to run the stargazer function and I don't understand. I have uninstalled the package, installed it again, restarted R, uninstalled and installed R.

Error in .stargazer.wrap(..., type = type, title = title, style = style, : could not find function ".stargazer.wrap"

The strangest thing is that stargazer was initially working and then it suddenly started throwing this error, every time I run it, with any type of data. With or without data. An example of data that I have tried:

model <- lm(mpg ~ wt, data = mtcars)

stargazer(model)

Error in .stargazer.wrap(..., type = type, title = title, style = style,  : 
  could not find function ".stargazer.wrap"

I have just realised that when running it like this it does work!

stargazer::stargazer(model, type='text')
5
  • 1
    Welcome to stack overflow. It's easier to help you if you make your question reproducible including data and your code which can be used to test and verify possible solutions. Have a look at How to Ask and minimal reproducible example
    – Peter
    Commented Jul 5, 2020 at 15:24
  • I have now! Is it more understandable?
    – Marina
    Commented Jul 5, 2020 at 17:08
  • Have you resolved your own question now? Did you load the package with library(stargazer)?
    – Peter
    Commented Jul 5, 2020 at 17:42
  • Not really. I don't understand why I need the double semicolon to use the stargazer function when I didn't before... And yes, I loaded the package with library(stargazer).
    – Marina
    Commented Jul 5, 2020 at 18:18
  • Usually you load a package using library("package name") at the start of your script. This gives you access to all the functions of that package, in your case the function stargazer(). An alternative approach to accessing functions from packages which are installed on your computer but not loaded into the script is to use the double colon notation "package name"::"function name"; in your case: stargazer::stargazer()
    – Peter
    Commented Jul 5, 2020 at 19:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.