Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

header generates NA in latex table #367

Open
YH244511 opened this issue Oct 21, 2022 · 1 comment
Open

header generates NA in latex table #367

YH244511 opened this issue Oct 21, 2022 · 1 comment

Comments

@YH244511
Copy link

Hi, I found that header
":_:" =list(" "=2, "A"=2, "B"=2)
produces
NA \cmidrule(lr){4-5} \cmidrule(lr){6-7}

Is there anyway to prevent etable generating "NA" for the first two columns? Thank you!

@Oravishayrizi
Copy link

Not the cleanest solution, but you can replace the white space with \phantom{x},

here is a mwe:

library(fixest)

packageVersion("fixest")
#> [1] '0.11.1'

lm1<-feols(Sepal.Length~Sepal.Width+Petal.Length|Species,iris)
lm2<-feols(Sepal.Length~Sepal.Width|Species,iris)
lm3<-feols(Sepal.Width~Sepal.Length+Petal.Length|Species,iris)
lm4<-feols(Sepal.Width~Sepal.Length|Species,iris)

# wo :_: - keeps the whitespace
etable(lm1,lm2,lm3,lm4,
       depvar = FALSE,
       headers= list("_Country"=list(" "=1, "A"=2, "B"=1) ),
       tex=TRUE)

# wo empty space - keeps the whitespace
etable(lm1,lm2,lm3,lm4,
       depvar = FALSE,
       headers= list(":_:Country"=list("a"=1, "A"=2, "B"=1) ),
       tex=TRUE)

# with empty space and :_: - replaces the space with NA 
etable(lm1,lm2,lm3,lm4,
       depvar = FALSE,
       headers= list(":_:Country"=list(" "=1, "A"=2, "B"=1) ),
       tex=TRUE)

# using vphantom - keeps the whitespace
etable(lm1,lm2,lm3,lm4,
       depvar = FALSE,
       headers= list(":_:Country"=list("\\phantom{A}"=1, "A"=2, "B"=1) ),
       tex=TRUE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants