dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
504 stars 77 forks source link

Absolute Noob Issue #123

Closed ssullivan6283 closed 3 years ago

ssullivan6283 commented 4 years ago

Hi, I apologize if this is easily solvable, but I've spent hours searching for a solution.

When generating a crosstab with summary tools, I keep receiving "
" in the dead center of longer variable names (ex: institutiona
l, where the variable is listed in my data frame (and print) as "institutional"). How do I remove this from the variable heading?

If it is helpful, these are the lines I'm entering in an attempt to generate the crosstab:

allcountiestab <- ctable(allcounties$county, allcounties$guardian.type, useNA="no", prop = "r", method = "render") view(dftab)

and here is a screen shot of my crosstab: issue

Thanks again so much for your replies and I'm sorry if this is the wrong place for this

dcomtois commented 4 years ago

Hi Sean,

No need to apologize, and your question is welcome.

Could you just provide a bit more context, as well as a reproducible example? I'd like to know why you're using method = "render", and what application/web browser shows those results that you screen-captured. Normally, <br/> appears as a line-break, so there is some sort of escaping going on here. If you know how to do this, pasting the source code would also be helpful. Thx,

ssullivan6283 commented 4 years ago

No need to apologize, and your question is welcome.

Thank you so much, I really appreciate you taking the time to help out

I'd like to know why you're using method = "render"

I actually removed "render", as I realized it wasn't necessary, but I'm still running into this issue.

Could you just provide a bit more context, as well as a reproducible example?

I'll do my best here an I apologize if I'm providing an example incorrectly, I used: actemp1 <- dput(df1) which output a very long summary of what I'm working with, so I've attached a .txt as to avoid flooding the screen. I hope this isn't an issue and I apologize if it is.

Following this output entered:

library(pander) library(summarytools)

actemptab <- ctable(actemp1$county, actemp1$guardian.type, useNA="no", prop = "r") view(actemptab)

I also unloaded all packages aside from pander and summarytools

what application/web browser shows those results that you screen-captured

This issue is encountered both in the Rstudio viewer and when opening the html file in the Firefox browser

If you know how to do this, pasting the source code would also be helpful.

I'm struggling to figure out how to share source code, sorry :(.

For what it's worth, I've created a lazy fix of editing html code in Firefox and then screenshotting that image to share for my presentation, so it's quite alright if you can't figure out what my issue is from the information I've provided.

Thanks again!!

actemp1.txt

dcomtois commented 4 years ago

Ok I'll take a look as soon as I can.

I do get the same results as you do. But just as a piece of information, to show the html source code, you only need to open the html file in your Web Browser and press Ctrl-U.

Cheers

dcomtois commented 4 years ago

Should work fine now, pls install dev-current branch using devtools or remotes (see main page for exact syntax if needed). I also added the "char.split" global option, so if you want to allow more (or less) characters in the table headings, just use for instance st_options(char.split=14). Let me know if that works as expected. Thx!