summarytools | R Package to Quickly and Neatly Summarize Data
kandi X-RAY | summarytools Summary
kandi X-RAY | summarytools Summary
summarytools is a an R package for data exploration and simple reporting.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of summarytools
summarytools Key Features
summarytools Examples and Code Snippets
Community Discussions
Trending Discussions on summarytools
QUESTION
I want to add variable labels to the frequency tables that I generated. But, I can't find that functionality in the summarytools documentation.
Here is my code:
the data ...ANSWER
Answered 2022-Jan-19 at 20:59This adds a "Variable" label about the field names and removes the double hashtags. I also adjusted the standard max-width of 940 px to 1000px -- however, if the actual long name is a lot longer than your example data, this won't be much help. I've provided comments (//
precedes inline comments in JS) so that you can see what each area of the Javascript is doing. You don't have to do anything special for the Javascript to work (it's built-in in R Markdown).
Using your code as it already is, add the following in as a chunk after your code.
If you try to run this chunk inline, it won't produce output. However, you'll see the output when you render.
For the questions added to the question labels, I've edited this to provide two different ways to do this. One uses R. The other uses JS.
I would suggest using R, because it's native. But you may have your own reasons for not doing so. This violates good naming practices, but it could be used for just these tables (if you wanted).
The R version is OPTION 1. This code goes between your data collection and storing the variable names in vct
. (I added vct
to this code, actually.)
QUESTION
I have data similar to the NHANES data I call below. What I would like to do is loop over a list of several variables to create crosstabs. I would like to stick with the summarytools::ctable package because I want to call the chisq argument. However, happy to use another approach, so long as the chisquare is an option and I can still remove NAs.
Here is what works so far. I am able to use the function below to generate simple frequencies. However, I would like the name of the variable to print before the frequency table. The function first prints all of the variable names THEN goes on to generate the frequencies so that is issue # 1 that I am struggling with:
...ANSWER
Answered 2021-Sep-20 at 04:47To solve the 1st issue use a for
loop.
QUESTION
I am using freq from library(summarytools) to create some frequencies.
Example:
...ANSWER
Answered 2021-Sep-10 at 11:33I do not know this function, but from what I searched this will give a similar result:
LibrariesQUESTION
Apologies if this has been asked elsewhere / if I am using the wrong terms, I have been trying to search for the correct way to do this but with no success so far.
I have an experimental design with 3 experimental conditions using repeated measures outcomes (each participant completes 4 trials). The data I have currently is in long format (each participant ID is repeated 4 times). I am trying to calculate summary statistics for the demographic variables (age, gender, condition etc.) but I cannot figure out how to, for lack of a better word, collapse/merge the rows for each participant together to get the frequency data and/or summary stats.
Below I have a simulated dataset
...ANSWER
Answered 2021-Jun-10 at 20:44If your demographic data don't vary across treatment rounds, you can just run distinct() or unique() by id, similar to what Jon Spring suggested, like this:
QUESTION
I have data as follows and I want to get rid of the variable type mentioned in the output(red).
...ANSWER
Answered 2021-May-30 at 09:21There is no built-in way to do it, but you can remove it manually:
QUESTION
I'm a big fan of R's simple functions like table() for quickly viewing bivariate tables but when I want frequencies & percentages in the same output, I use ctable() from the summarytools package.
Sometimes I have long variable names, which is no problem for table(); I just do a quick rename in the table() function. However, I haven't figured out how to do the same sort of variable label renaming for the ctable() output. I found a few posts on SO about ctable() and labeling, but these pertained to other, more complex work such as involving kable() and Rmarkdown. I'm looking to keep everything tucked within the raw console output, preferable all within ctable() or perhaps nested inside another function like print().
Here are code examples of what I'd like to do and where I'm stuck so far.
...ANSWER
Answered 2021-Apr-15 at 07:36Use dnn
:
QUESTION
ANSWER
Answered 2021-Jan-19 at 16:22The below code should solve the problem. I changed mainly two things:
- I replaced
renderTable
withrenderUI
- I added the argument
method = "render"
to thesummarytools::dfSummary
function
QUESTION
I am using R and I would like to export this summary as a PNG file. Can anyone help me please? Thank you!
...ANSWER
Answered 2021-Jan-18 at 21:41To export it as PNG, you can use:
QUESTION
Why does save_kable
command of the kableExtra
package results in bad resolution PDF? I have observed that when a PDF is rendered with magick
(which is standard in kableExtra
) the quality is pretty bad (see screenshot below). When magick
is not installed, it works, but with another renderer (Qt5.5.1 in my case; Macbook Pro 2018, OSX 10.14.6; imagemagick@6 is installed vie brew). However, uninstalling R's magick
, rebooting etc. works but is not convenient (especially if you need magick also for other R packages like summarytools
) and therefore does not turn out to be a permanent solution. I might handle something not in the way it was intended and I am happy to get some help on this.
ANSWER
Answered 2020-Sep-30 at 09:35Fortunately, I found a solution which looks pretty standard. Simply include density
in the save_kable
function. This would have save me a lot of time.
QUESTION
The explicit headers I add to a Rmd file (e.g. ## Section 1) are recognised fine using yaml like this:
...ANSWER
Answered 2020-Sep-24 at 14:05Instead of raw HTML, have your results="asis"
block output markdown.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install summarytools
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page