Stargazer Error in RMarkdown

I am running the following code on two data frames:

stargazer(as.data.frame(df[c("bm", "roa", "debt_assets", "at", "inst_hold")]), 
          nobs = FALSE,
          digits = 2,
          covariate.labels = c("Book-to-Market", "Return on Assets", "Leverage", "Total Assets", "Institutional Ownership"),
          notes = "\\textit{N} = 5,361 firm-year observations.")

The code works on one data frame but not the other, although the two data frames are set up identically. I am getting the error message:

Error in if (is.na(s)) { : the condition has length > 1
Calls: <Anonymous> ... .stargazer.wrap -> .get.object.names -> .inside.bracket
Execution halted

Any help would be greatly appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.