Giter Club home page Giter Club logo

stargazer-booktabs's Issues

Error after installing `stargazer-booktabs`

After installing stargazer-booktabs via devtools, whenever I try to produce tables with stargazer the following error is produced:

Error in if (class(objects[[i]]) %in% c("coeftest", "lmerMod", "glmerMod",  : 
  the condition has length > 1

Also, it is somewhat unclear to me how stargazer-booktabs works. After installing from github via devtools, does simply loading stargazer and using it normally produce output with \toprule, \midrule, and \bottomrule? Or does it only produce these when compiling in an RMarkdown document with booktabs loaded?

How to install?

Hello! I would love to give this a try but I am at a loss on how to install this. Could you give me a quick jump start on this? Thanks!

format.alignment error for data frame with summary=FALSE

When using stargazer-booktabs to output a LaTeX table reproducing the contents of a data frame (so with the summary option set to FALSE) I get the following error:

Error in paste(.formatting.alignment, "c", sep = "") : 
  object '.formatting.alignment' not found

Here is a simple example to illustrate the issue:

> df <- data.frame(Name = c("John", "Abigail", "Paul"),
+                  Age  = c(30, 25, 49))
> stargazer(df, summary=FALSE)

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Fri, Jul 27, 2018 - 12:58:39
\begin{table}[!htbp] \centering 
  \caption{} 
  \label{} 
Error in paste(.formatting.alignment, "c", sep = "") : 
  object '.formatting.alignment' not found

The code above works fine prior to installing stargazer-booktabs. I did a clean install of both stargazer and stargazer-booktabs today prior to running this code. In the past I've had no issues with stargazer-booktabs for regression output.

Thank you very much for your time and for this very useful fork!

formatting.alignment giving error

When outputting a table from R using your Stargazer fork I get an error:

Extra }, or forgotten \endgroup. ...}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
Package array Error: Illegal pream-token ({5pt): `c' used. ...}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }

It seems to come from

#.formatting.alignment <- paste("@{\\extracolsep{",.format.column.sep.width,"}}l", sep="")
.formatting.alignment <- paste("{{",.format.column.sep.width,"}}l", sep="")

Manually replacing {5pt} with @{\extracolsep{5pt}} works.

MWE:

R:

sample <- data.frame(x = c(1,2,3), y = c(4,5,6))
stargazer(sample,
          type = "latex", summary = TRUE, float = FALSE,
          digits = 2, align = TRUE)

Latex:

\documentclass[]{article}
\usepackage{booktabs}
\usepackage{dcolumn}

\begin{document}

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: ons., okt 04, 2017 - 10:56:05
% Requires LaTeX packages: dcolumn 
\begin{table}
	\begin{tabular}{{{5pt}}lD{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
		\toprule 
		 
		Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Max} \\ 
		\midrule \\[-2.1ex] 
		x & 3 & 2.00 & 1.00 & 1 & 3 \\ 
		y & 3 & 5.00 & 1.00 & 4 & 6 \\ 
		\midrule \\[-2.1ex] 
	\end{tabular} 
\end{table}
\end{document}

Exporting latex code to .tex throws error

Exporting tables to .tex gives an error. Using your example:

t <- data.frame(Income = runif(20), 
                Wealth = runif(20), 
                Children = runif(20), 
                Age = runif(20), 
                male = rep(c(T,F),times=10))

c1 <- lm(Income ~ Age, data = t, subset = male == T)
c2 <- lm(Wealth ~ Age, data = t, subset = male == F)
c3 <- lm(Children ~ Age, data = t)

stargazer(c1,c2,c3,
          style="aer", out = tempfile(fileext = ".tex"),
          omit.table.layout = "n", 
          omit.stat=c("adj.rsq", "f", "ser"), 
          omit=c("Constant"), 
          float=T, 
          title = "Columns for dependent variables",
          add.lines = list(c("Controls","N","N","N")))
Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : 
  missing value where TRUE/FALSE needed

Documentation?

It's pretty unclear what one has to do to use this library. Spare some details in the README.md?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.