November 2021
November 1
If you write documents using R, you may wish to spell check to find possible spelling mistakes.
โ R Function A Day (@rfunctionaday) November 1, 2021
The {spell_check_*} function family from {spelling} ๐ฆ makes this easy for selected text, a collection of documents, or a package ๐https://t.co/IxvzK0f9r1#rstats #DataScience pic.twitter.com/9bkSWUjakn
November 2
Sometimes we may wish to check all relevant assumptions for a linear regression model in one go.
โ R Function A Day (@rfunctionaday) November 2, 2021
The {gg_diagnose} function from {lindia} ๐ฆ does this for lm objects and provides helpful {ggplot2} visualizations โ ๐https://t.co/12Q5NT3c6P#rstats #DataScience pic.twitter.com/1bMYhDxosT
November 3
Sometimes you need to display two plots, not in a grid, but one inside the other (aka "inset" plot).
โ R Function A Day (@rfunctionaday) November 3, 2021
Assuming you are using the grammar of graphics approach, this is easy to do using {inset_element} function from {patchwork} ๐ฆ! ๐ฉโ๐ญhttps://t.co/H2A9Yh0W6f#rstats #DataScience pic.twitter.com/2diq1akqay
November 4
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) November 4, 2021
The {cppFunction} from {Rcpp} ๐ฆprovides a convenient way to do so! โก๏ธhttps://t.co/xL92m6Jlub#rstats #DataScience pic.twitter.com/MIlRxRciMN
November 5
A dot plot is a simple yet informative way to visualize the distribution of continuous or quantitative variables.
โ R Function A Day (@rfunctionaday) November 5, 2021
The {geom_dotsinterval} function from {ggdist} ๐ฆ provides the needed geometric layer! ๐ต๐ดhttps://t.co/n67JhkqJfr#rstats #DataScience pic.twitter.com/XuqjlSWBbj
November 6
When numerous key-pair values are specified in an environment, R's performance can degrade because of a significant amount of memory leakage.
โ R Function A Day (@rfunctionaday) November 6, 2021
The {fastmap} function from the eponymous ๐ฆ provides a more performant alternative! ๐https://t.co/H7dZxlZixI#rstats #DataScience pic.twitter.com/Hxai0xP0KZ
November 7
While exploring data, one often needs a quick and easy way to create dot-and-whisker plots of coefficient estimates for regression models.
โ R Function A Day (@rfunctionaday) November 7, 2021
The {plot_model} function from {sjPlot} ๐ฆ produces such plots for a wide range models ๐https://t.co/S4iMdhxUbB#rstats #DataScience pic.twitter.com/azkYut7LkL
November 8
While analyzing text data, if you filter out stop words, you may wish to have them readily available in R.
โ R Function A Day (@rfunctionaday) November 8, 2021
The {generate_stoplist} function from {tidystopwords} ๐ฆ provides them in more than 100 languages! ๐https://t.co/fZK57AClCG#rstats #DataScience pic.twitter.com/R4aYJzr7CF
November 9
If you have a complex study design, before simulating it, you may first wish to validate it with a mock dataset.
โ R Function A Day (@rfunctionaday) November 9, 2021
The {check_design} function from {faux} ๐ฆ provides a quick and easy visual way to do so! ๐https://t.co/N20EV0caL7#rstats #DataScience pic.twitter.com/dcG5cpLJ3j
November 10
Sometimes you may need to operate on video files in R (e.g., change file format, convert to images, etc.).
โ R Function A Day (@rfunctionaday) November 10, 2021
The {av_*} function family from {av} ๐ฆ provides numerous helpers to this end! ๐ฅhttps://t.co/v5mgjqqCQr#rstats #DataScience pic.twitter.com/21DWBeT0gq
November 11
If RStudio is your preferred IDE for R, you may wish to list and change your current preferences programmatically, rather than pointing and clicking.
โ R Function A Day (@rfunctionaday) November 11, 2021
The {* _rstudio_prefs} function family in {rstudio.prefs} ๐ฆ provides this! โ https://t.co/IXw9ciTFZ7#rstats #DataScience pic.twitter.com/IwTJHUFjle
November 12
Lorenz curves provide a good way to visualize inequality in the distribution of a variable (like wealth).
โ R Function A Day (@rfunctionaday) November 12, 2021
The {stat_lorenz} function from {gglorenz} ๐ฆprovides the needed geometric layer to create such a curve easily ๐https://t.co/AJpWz8rHCr#rstats #DataScience pic.twitter.com/4bCGp9mrQq
November 13
Sometimes you may wish to quickly prepare a frequency table for categorical variables.
โ R Function A Day (@rfunctionaday) November 13, 2021
The {datasummary_crosstab} function from {modelsummary} ๐ฆ provides output with rich details! ๐งฎ
https://t.co/ropUkhXb1v#rstats #DataScience pic.twitter.com/plsTArmYA1
November 14
If you have a number of rows in your visualization, you may wish to individuate them with the help of different background colours.
โ R Function A Day (@rfunctionaday) November 14, 2021
The {geom_stripped_rows} function from {GGally} ๐ฆ provides the perfect geometric layer! ๐ฆhttps://t.co/S12QxH4r8Y#rstats #DataScience pic.twitter.com/DnEgVri8yc
November 15
If you are used to doing string interpolation in R using the {glue} ๐ฆ, you may wish to have a similar helper while writing SQL queries.
โ R Function A Day (@rfunctionaday) November 15, 2021
The {glue_sql} function cleverly handles SQL quoting while writing queries โ๏ธhttps://t.co/3zGFUR1m2e#rstats #DataScience pic.twitter.com/jeAVIRZaYS
November 16
Given the diversity of time series classes in the R ecosystem, you may wish to have a universal converter for interchanging classes.
โ R Function A Day (@rfunctionaday) November 16, 2021
The {ts_*} function family in {tsbox} ๐ฆ provides just the tools! ๐ https://t.co/yqNT5DaLns#rstats #DataScience pic.twitter.com/Yf8vMAMIjt
November 17
For correlation hypotheses, one may wish to simultaneously visualize both the joint and the marginal distributions.
โ R Function A Day (@rfunctionaday) November 17, 2021
The {ScatterHist} function from {WVPlots} ๐ฆ does this by default (with statistical summary as a plus) ๐https://t.co/DjZxh7OGG5#rstats #DataScience pic.twitter.com/Se1tOBNLR0
November 18
If you use project-oriented workflows, instead of changing a working directory, you may wish to construct file paths relative to the top-level directory.
โ R Function A Day (@rfunctionaday) November 18, 2021
The eponymous function from {here} ๐ฆ provides this functionality ๐ https://t.co/qutCsLDu8e#rstats #DataScience pic.twitter.com/0HYc2zVDu6
November 19
Sometimes you need to rank-transform your data, present either in a vector or in a dataframe.
โ R Function A Day (@rfunctionaday) November 19, 2021
The {ranktransform} function from {datawizard} ๐ฆ allows you to do this quite flexibly! 1๏ธโฃ2๏ธโฃ3๏ธโฃhttps://t.co/S5i3g69jn6#rstats #DataScience pic.twitter.com/ySPWE7VpFe
November 20
Pie charts provide an informative but imperfect way to visualize categorical data, but squared pie (or waffle) charts overcome some of these imperfections.
โ R Function A Day (@rfunctionaday) November 20, 2021
The {waffle} function from the eponymous ๐ฆ easily produces them ๐ง https://t.co/OxtCuCMhHF#rstats #DataScience pic.twitter.com/1ui2OqHJ8k
November 21
Apache Spark is a popular platform for large-scale data processing, and you may wish to use the familiar dataframe-based workflows with it from R.
โ R Function A Day (@rfunctionaday) November 21, 2021
The {copy_to} function from {sparklyr} ๐ฆ can convert dataframes to Spark objects! โก๏ธhttps://t.co/YpsY9738WF#rstats #DataScience pic.twitter.com/TPWcsNraPK
November 22
Sometimes we wish to combine various figures into a single, compound figure to convey an overarching point.
โ R Function A Day (@rfunctionaday) November 22, 2021
The {plot_grid} function from {cowplot} ๐ฆ provides a way to do so flexibly! ๐งโ๐ญhttps://t.co/5cQUrPQpJz#rstats #DataScience pic.twitter.com/VONCYetz1x
November 23
If you use {dm} ๐ฆ to create data model objects representing tables in a relational database, you may wish to visualise the relations between the tables.
โ R Function A Day (@rfunctionaday) November 23, 2021
The {dm_draw} function does exactly this! ๐ธhttps://t.co/OmDHyi8Ig9#rstats #DataScience pic.twitter.com/OHIHpLbdgG
November 24
Either while debugging or learning a new function, you may wish to understand its implementation logic.
โ R Function A Day (@rfunctionaday) November 24, 2021
The {flow_view} function from {flow} ๐ฆ helps visualizes this logic via a flow diagram! ๐ท๐ถhttps://t.co/f5ubm3fq7T#rstats #DataScience pic.twitter.com/yR7AS9stSk
November 25
During the data-wrangling stage, sometimes you may wish to compare how the dataframe at the current stage differs from the original one.
โ R Function A Day (@rfunctionaday) November 25, 2021
The {rCompare} function from {dataCompareR} ๐ฆ provides just the tool! ๐๐https://t.co/btUd1vK0dj#rstats #DataScience pic.twitter.com/x8xGL4MUqn
November 26
Sometimes we may wish to assess the polarity (positive, negative, neutral) of text data.
โ R Function A Day (@rfunctionaday) November 26, 2021
The {get_sentiment} function from {syuzhet} ๐ฆ provides a convenient way to approximate the sentiment of the text by sentence! โโhttps://t.co/Pv9tCBxzYM#rstats #DataScience pic.twitter.com/us9PiBzRcb
November 27
The first important step of a data analysis workflow is to make sure that everything about your data โmakes senseโ.
โ R Function A Day (@rfunctionaday) November 27, 2021
The {diagnose} function from {dlookr} ๐ฆ provides a detailed data diagnosis report that makes this step easy! ๐https://t.co/UoUEdrfUTU#rstats #DataScience pic.twitter.com/eVxrpd0rjc
November 28
Chloropleth maps provide a convenient way to show variation in a quantitative variable across locations.
โ R Function A Day (@rfunctionaday) November 28, 2021
The {mf_map} function from {mapsf} ๐ฆ easily draws such maps with elegant defaults! ๐บhttps://t.co/QitknL32Jh#rstats #DataScience pic.twitter.com/JMCtpdEYnY
November 29
If we want to print an HTML document produced by Rmarkdown, we may also wish that it were paginated.
โ R Function A Day (@rfunctionaday) November 29, 2021
The {html_paged} function from {pagedown} ๐ฆ provides an HTML document split into multiple pages! ๐๐จhttps://t.co/wMofeBVYuc#rstats #DataScience pic.twitter.com/L1sXZrh4Xz
November 30
A correlation matrix compactly shows relationships between multiple variables. But, for pipe-based workflows, it is often helpful to have them in a dataframe.
โ R Function A Day (@rfunctionaday) November 30, 2021
The {correlate} function from {corrr} ๐ฆ makes it easy to extract them!https://t.co/TAMnjQQTAT#rstats #DataScience pic.twitter.com/aLN7k9uvGy