August 2021
August 1
Sometimes you may wish to insert a textual table in a {ggplot2} plot the same way you insert text labels at a specified position.
β R Function A Day (@rfunctionaday) August 1, 2021
The {geom_table} function from {ggpp} π¦ offers just the geometric layer! πhttps://t.co/bQdaxiMffR#rstats #DataScience pic.twitter.com/6raba4JIDV
August 2
If you are used to {dplyr}'s pipeable syntax (using
β R Function A Day (@rfunctionaday) August 2, 2021%>%
) and wish to continue using it when you switch to {data.table}, the {dt} helper function from {tidytable} π¦ can help! π©βπ§https://t.co/YzFfw2meLF#rstats #DataScience pic.twitter.com/3SQqnjj3Bz
August 3
If you are used to reading code with syntax highlighting, you may wish the same when code is printed in the terminal/console.
β R Function A Day (@rfunctionaday) August 3, 2021
The {prettycode} function from the eponymous π¦ does exactly this! π¨https://t.co/dF1WYPJSSc#rstats #DataScience pic.twitter.com/4fK9FjnTOu
August 4
Compared to CSS, Sass is a more flexible HTML styling framework. As it becomes ubiquitous, you may wish to learn how Sass code you are reading translates to familiar CSS.
β R Function A Day (@rfunctionaday) August 4, 2021
The {sass} function from the eponymous π¦ does this πhttps://t.co/FR8UlmQyTY#rstats #DataScience pic.twitter.com/3ZgYl0E6j3
August 5
A dot plot is a good visualization to represent the distribution of labeled numeric data.
β R Function A Day (@rfunctionaday) August 5, 2021
The {ggdotplotstats} function from {ggstatsplot} π¦ easily produces these charts (with additional descriptive and inferential statistics) πhttps://t.co/OLcqX643Vx#rstats #DataScience pic.twitter.com/GZ3huWi9qU
August 6
If you know C and wish to understand the implementation of R data structures at C-level as S-expressions or SEXPs (https://t.co/pCGK6tlgNB), the {sxp} function from {lobstr} π¦ can be helpful! βοΈhttps://t.co/pb7um2e1RR#rstats #DataScience pic.twitter.com/NYrdqEJqJW
β R Function A Day (@rfunctionaday) August 6, 2021
August 7
For teaching or for quality assessment, we may sometimes wish to visualize residuals of a model to check the goodness of fit.
β R Function A Day (@rfunctionaday) August 7, 2021
The {stat_fit_deviations} function from {ggpmisc} π¦ makes this easy in {ggplot2} πhttps://t.co/YezhmuyXgP#rstats #DataScience pic.twitter.com/M6o4MAcnIH
August 8
If we need to write an "impure" function that modifies R landscape (e.g.Β changes working directory), we'd do it so that behavior of other R functions doesn't change.
β R Function A Day (@rfunctionaday) August 8, 2021
The {local_} function family in {withr} π¦ can help to do so! π₯‘https://t.co/CgklVPJp7n#rstats #DataScience pic.twitter.com/rrpbojxoev
August 9
Gelman and Hill (2007) propose a binned residual plot to check the under-or over-fitting of binomial logistic regression models. 0β£1β£
β R Function A Day (@rfunctionaday) August 9, 2021
The {binned_residuals} function from {performance} π¦easily produces such visualization πhttps://t.co/gAAjFNIf92#rstats #DataScience pic.twitter.com/cKw8CxpJfC
August 10
Even after doing everything you can in R, sometimes you may want to further improve the performance of your code by rewriting it in C++.
β R Function A Day (@rfunctionaday) August 10, 2021
The {cpp_function} from {cpp11} π¦ provides a convenient way to do so πhttps://t.co/5fdrx9KPc6#rstats #DataScience pic.twitter.com/IbKeeuZdjb
August 11
For common statistical tests, we may wish to extract not only the details of inferential statistics but also effect size estimates.
β R Function A Day (@rfunctionaday) August 11, 2021
Functions, like {two_sample_test}, from {statsExpressions} π¦ provide a tidy way to do so πhttps://t.co/MJ1avaR6WJ#rstats #DataScience pic.twitter.com/zKFUetTeXR
August 12
Sometimes data analysis may require finding the first non-missing value (to replace it with another value, to create a new variable, etc.) across vectors or columns.
β R Function A Day (@rfunctionaday) August 12, 2021
The {coalesce} function from {dplyr} π¦ comes in handy here πhttps://t.co/Q7EPEAmFZC#rstats #DataScience pic.twitter.com/Upqhjd5eJY
August 13
Unified Modeling Language provides a way to visualize the design of a system, and nomnoml (https://t.co/X9yAhs166L) is online tool to draw UML diagrams.
β R Function A Day (@rfunctionaday) August 13, 2021
The {nomnoml} function from eponymous π¦ renders UML diagrams from R itself! πhttps://t.co/CBZgudgltr#rstats #DataScience pic.twitter.com/KmksKDgQPz
August 14
Sometimes you might need to analyze the scanned text data present in a PDF.
β R Function A Day (@rfunctionaday) August 14, 2021
The {pdf_ocr_text} function from {pdftools} π¦ can extract such text βhttps://t.co/cnoqBhZ0Ys#rstats #DataScience pic.twitter.com/1LMVHfGgsL
August 15
Although {rmarkdown} π¦ makes writing reports easy, it lacks automatic numbering of and cross-referencing (for figures, tables, sections, etc) features.
β R Function A Day (@rfunctionaday) August 15, 2021
The 2nd variant of function family in {bookdown} π¦ provides these features βοΈhttps://t.co/EKFeVqQJb1#rstats #DataScience pic.twitter.com/RcIAtscT0K
August 16
The {tmap} π¦ provides API to create (static and interactive) thematic maps with a syntax resembling that of {ggplot2}.
β R Function A Day (@rfunctionaday) August 16, 2021
The {qtm} function provides a convenient short-hand to draw such maps quickly! πΊοΈhttps://t.co/WDYN5ofasw#rstats #DataScience pic.twitter.com/PZk4thnd4q
August 17
Sometimes we need to convert a deeply nested list into a rectangular dataframe. But in doing so, we may not wish to bring to the top all list elements.
β R Function A Day (@rfunctionaday) August 17, 2021
The {hoist} function from {tidyr} π¦ can help with such transformations π οΈhttps://t.co/yrhHtF2YVl#rstats #DataScience pic.twitter.com/m5TvEse0bm
August 18
Sometimes we want to draw text in a {ggplot2} plot so that it fits inside a defined area without manually fiddling around with font size.
β R Function A Day (@rfunctionaday) August 18, 2021
The {geom_fit_text} function from {ggfittext} π¦ resizes text to fit inside a defined box ποΈhttps://t.co/GiaXx9QEgb#rstats #DataScience pic.twitter.com/krnvdRqIWz
August 19
Posterior predictive check for a regression model uses simulated data under the fitted model to check for any discrepancies from observed data.
β R Function A Day (@rfunctionaday) August 19, 2021
The {pp_check} function from {performance} π¦ carries out and visualizes this check πhttps://t.co/qk7dnlHyP5#rstats #DataScience pic.twitter.com/R95Evuhhdp
August 20
If you use {dplyr} π¦, you may wish to avoid the {group_by} + {ungroup} workflow for grouped analysis if you just need to carry out a single operation.
β R Function A Day (@rfunctionaday) August 20, 2021
The {with_groups} function provides an alternative for such contexts βοΈhttps://t.co/FiEeP2loxm#rstats #DataScience pic.twitter.com/XANjLS22ki
August 21
Sometimes you may wish to display results from a statistical test in a graphics you have prepared.
β R Function A Day (@rfunctionaday) August 21, 2021
The {statsExpressions} π¦ functions, like {corr_test}, provide the necessary expressions πhttps://t.co/ERUsOJKliZ#rstats #DataScience pic.twitter.com/4T3awwOSFQ
August 22
For some reason, you may need to prepare a calendar in R and you might prefer to do so in the {ggplot2} framework.
β R Function A Day (@rfunctionaday) August 22, 2021
The {calendR} function from the eponymous π¦ provides customizable monthly or yearly calendars π https://t.co/KPx4ozhjrV#rstats #DataScience pic.twitter.com/C1dM0FSllv
August 23
The {mlr3} project is a modern and powerful object-oriented framework for doing machine learning (ML) in R.
β R Function A Day (@rfunctionaday) August 23, 2021
The {autoplot} function from {mlr3viz} π¦ provides a model-agnostic general-purpose tool for visualizing ML algorithms! ππhttps://t.co/ky8yhLtYyG#rstats #DataScience pic.twitter.com/YBu2rLz44K
August 24
Instead of using third-party softwares, you may sometimes wish to edit (join, convert, etc.) images from within R itself.
β R Function A Day (@rfunctionaday) August 24, 2021
The {image_} function family from {magick} provide such helpers π·πhttps://t.co/ald6jelSWG#rstats #DataScience pic.twitter.com/y4H67cTPnY
August 25
For correlation hypotheses, in addition to the joint distribution in a scatterplot, one may also wish to visualize the marginal distributions for each variable.
β R Function A Day (@rfunctionaday) August 25, 2021
This is easy to do using the {_side} function family from {ggside} π¦ !https://t.co/vQYV4ELEaG#rstats #DataScience pic.twitter.com/VSBpVqtO6K
August 26
The UpSet plot is an efficient alternative to the Venn Diagram for visualizing a complex intersections of multiple sets.
β R Function A Day (@rfunctionaday) August 26, 2021
The {scale_x_upset} function from {ggupset} π¦ provides a {ggplot2} scale to create UpSet plots easily π§±https://t.co/5rwIgAhzxa#rstats #DataScience pic.twitter.com/wk352FtXb0
August 27
Sometimes (e.g.Β for meta-analysis) we may need to either extract effect size from a test statistic or convert the available effect size to a more suitable one.
β R Function A Day (@rfunctionaday) August 27, 2021
The {to} function family from {effectsize} can do such conversions πhttps://t.co/EO6hb9NkER#rstats #DataScience pic.twitter.com/2ItAfBPwps
August 28
A correlation matrix is a nifty visualization for displaying relationships between multiple variables.
β R Function A Day (@rfunctionaday) August 28, 2021
The {ggcorrmat} function from {ggstatsplot} π¦ creates such matrices with significance testing and other descriptive details βοΈοΈhttps://t.co/rbwEs6qVON#rstats #DataScience pic.twitter.com/EDPanyNE0x
August 29
For a given generic or class, sometimes we may be interested to systematically list and investigate the available S3/S4 methods.
β R Function A Day (@rfunctionaday) August 29, 2021
The {methods} function family in {sloop} π¦ provides the needed helpers πhttps://t.co/EV7AVaSHPF#rstats #DataScience pic.twitter.com/XxFb3Es3pB
August 30
When we are interested in studying group differences, sometimes we may wish to annotate our visualizations with results from significance testing.
β R Function A Day (@rfunctionaday) August 30, 2021
The {geom_signif} from {ggsignif} π¦ provides just the geometric layer! βοΈhttps://t.co/O9XM5nHdgf#rstats #DataScience pic.twitter.com/iZhilHeGO3
August 31
YAML language is ubiquitous, esp.Β in configuration files, and sometime we may need to convert R object to a YAML object.
β R Function A Day (@rfunctionaday) August 31, 2021
The {as_yml} function from {ymlthis} π¦ makes this conversion easy πhttps://t.co/GSTD3slB0k#rstats #DataScience pic.twitter.com/YeVunUZoR8