December 2021
December 1
ROC curves provide a convenient way to compare responses and predictions of a binomial model, and sometimes you may also need to plot multiple curves.
β R Function A Day (@rfunctionaday) December 1, 2021
The {geom_roc} function {plotROC} π¦ can do it all! πͺhttps://t.co/dbmEIkLfNM#rstats #DataScience pic.twitter.com/H2gejkYnvI
December 2
Either while learning or exploring the distribution of our data, we may wish to visualize the shape of various statistical distributions.
β R Function A Day (@rfunctionaday) December 2, 2021
The {vdist_*} function family from {vistributions} π¦ makes this easy! πhttps://t.co/iqSh2nnKWF#rstats #DataScience pic.twitter.com/XDccj6H5Dy
December 3
A level plot displays spatial data in two rather than three dimensions, and sometimes we may wish to create such visualisation for
β R Function A Day (@rfunctionaday) December 3, 2021RasterLayer
objects.
The {levelplot} function from {rasterVis} π¦ does so elegantly and flexibly!https://t.co/TTYvQLpIbZ#rstats #DataScience pic.twitter.com/S5g6fQUAw7
December 4
Sometimes you wish to remove only certain rows or columns that are completely empty instead of partly empty.
β R Function A Day (@rfunctionaday) December 4, 2021
The {remove_empty_*} helper function family from {sjmisc} π¦ do exactly this! π§Ήhttps://t.co/P6z56VFxPD#rstats #DataScience pic.twitter.com/zKDdFpxscn
December 5
Modern OS, devices, etc. offer dark mode, and you may wish to use it also for your visualizations to match this color scheme.
β R Function A Day (@rfunctionaday) December 5, 2021
The {dark_theme_*} function family from {ggdark} π¦ offers dark mode for {ggplot2} visualizations! πhttps://t.co/MAAA7DadAQ#rstats #DataScience pic.twitter.com/foWfo0Hquh
December 6
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) December 6, 2021
The {add_pval} from {ggpval} π¦provides a way to do this! βοΈhttps://t.co/X1pKEeFHnG#rstats #DataScience pic.twitter.com/xixLLhcHlE
December 7
If you use Qualtrics surveys to collect data on a crowdsourcing website (like MTurk), you may wish to exclude responses based on specified exclusion criteria.
β R Function A Day (@rfunctionaday) December 7, 2021
The {exclude_*} function family from {excluder} π¦ makes this easy! βοΈhttps://t.co/Nhl8MqQEXH#rstats #DataScience pic.twitter.com/CDqpV10RN1
December 8
To have a consistent coding style, we need to adopt a naming convention and stick to it in the codebase.
β R Function A Day (@rfunctionaday) December 8, 2021
The {to_any_case} function from {snakecase} π¦ can help convert strings to any desired case! ππͺhttps://t.co/sHkKj1dLgV#rstats #DataScience pic.twitter.com/MNVuzLIrjF
December 9
Although descriptive statistics are helpful, computing them can be tricky, especially for complicated designs.
β R Function A Day (@rfunctionaday) December 9, 2021
The {suberbPlot} function from {superb} π¦ makes this easy for various designs, sampling schemes, population sizes, etc.!https://t.co/5bXZF7pt5x#rstats #DataScience pic.twitter.com/VOEofPuSxn
December 10
Sometimes you may wish to encode values to a shape in a visualisation but may find the default shapes to be not distinctive enough.
β R Function A Day (@rfunctionaday) December 10, 2021
The {geom_star} function from {ggstar} π¦ provides just the shapes! π§βοΈβοΈhttps://t.co/ecTTbN44cv#rstats #DataScience pic.twitter.com/icpTqfUK2W
December 11
Line charts can represent variation in quantitative values across ordered measurements (e.g.Β across time).
β R Function A Day (@rfunctionaday) December 11, 2021
The {gg_line_facet} function from {simplevis} π¦ creates such charts with elegant defaults πhttps://t.co/A4k8DMTDUf#rstats #DataScience pic.twitter.com/1p1TqWH4Bz
December 12
Sometimes we want to adjust data by regressing out effects of selected variables.
β R Function A Day (@rfunctionaday) December 12, 2021
The {adjust} function from {datawizard} π¦ does so easily and flexibly! πhttps://t.co/lI6JSpnlfb#rstats #DataScience pic.twitter.com/A3No7I2ymW
December 13
Bar charts provide a great way to visualize the magnitude of the quantitative values across different categories.
β R Function A Day (@rfunctionaday) December 13, 2021
The {bar_chart} function from {ggcharts} π¦ produces them easily! πhttps://t.co/j4c3C1gVZI#rstats #DataScience pic.twitter.com/ma0Wl1J6cK
December 14
You may wish to prepare shareable project analysis docs, with emphasis on reproducibility and efficient project management.
β R Function A Day (@rfunctionaday) December 14, 2021
The {wflow_*} function family from {workflowr} π¦ makes this easy with a version-controlled website! πhttps://t.co/GTMWYeYuEm#rstats #DataScience pic.twitter.com/Rqi5yE6dl8
December 15
While annotating plotted data with labels, we may wish to do so in a way that overlap between labels is minimized.
β R Function A Day (@rfunctionaday) December 15, 2021
The {geom_label_repel} function from {ggrepel} π¦ provides a clever and performant way to do so! πhttps://t.co/GU3SQS1YWt#rstats #DataScience pic.twitter.com/1UX56FSeNX
December 16
Sometimes we need to operate over a list or vector, either by position or by name, to get both the index and the value of interest.
β R Function A Day (@rfunctionaday) December 16, 2021
The {imap} function family from {purrr} π¦ can be of help here πhttps://t.co/U5IHEt8hpt#rstats #DataScience pic.twitter.com/Fsyahp4tb8
December 17
Sometimes the rmarkdown source file alone isn't enough to reproduce the report, and additional files (e.g.Β data) need to be embedded.
β R Function A Day (@rfunctionaday) December 17, 2021
The {embed_*} function family from {xfun} π¦ does so by encoding the files to base64 format! πhttps://t.co/oA04uKnV3F#rstats #DataScience pic.twitter.com/NA6jzbr2YN
December 18
Often we need to work, not with a specific date, but rather with intervals containing start and end dates.
β R Function A Day (@rfunctionaday) December 18, 2021
The {int_*} function family from {lubridate} π¦ makes it easy to operate on intervals πhttps://t.co/beoBq6Rlr3#rstats #DataScience pic.twitter.com/8mMnL0nJwC
December 19
If you inherit a folder with many files, it can be cumbersome to go through them and find missing packages to install.
β R Function A Day (@rfunctionaday) December 19, 2021
The {show_*} function family from {reinstallr} π¦ can list used packages and highlight the ones missing! πhttps://t.co/KrhtH0DT2X#rstats #DataScience pic.twitter.com/nZLLvDN9jP
December 20
Sometimes it can be useful to mark the centroid of a group of observations with a point or with a label.
β R Function A Day (@rfunctionaday) December 20, 2021
The {stat_centroid} function from {ggpp} π¦provides a way to do so! πhttps://t.co/FaAYMnOFW7#rstats #DataScience pic.twitter.com/gwfY7uyrPK
December 21
During data wrangling stage, sometimes we may need to rotate the dataframe (such that rows become columns and vice versa).
β R Function A Day (@rfunctionaday) December 21, 2021
The {rotate_df} function from {sjmisc} π¦ provides just the tool! π§https://t.co/fB1vqf4uqu#rstats #DataScience pic.twitter.com/yw2aO2oLxZ
December 22
Sometimes you may wish to quickly build an elegant and sharable website.
β R Function A Day (@rfunctionaday) December 22, 2021
The {create_postcard} function from {postcards} π¦ creates pretty, single-page websites with customizable Rmarkdown template! β¨πhttps://t.co/0eZUTkkd16#rstats #DataScience pic.twitter.com/izucxUyfQ6
December 23
If you wish to write functions that save data to a user's computer, you need to find an appropriate directory depending on the OS.
β R Function A Day (@rfunctionaday) December 23, 2021
The {user_*_dir} function family from {rappdirs} π¦ makes this easy! πhttps://t.co/XUPMngVMz9#rstats #DataScience pic.twitter.com/ps2ISHwql6
December 24
JSON data representation format is ubiquitous, and sometimes we might need to convert a dataframe in R to a JSON object.
β R Function A Day (@rfunctionaday) December 24, 2021
The {to_json} function from {jsonify} π¦ provides a convenient and fast way to do so! πhttps://t.co/CDUlMuB6fE#rstats #DataScience pic.twitter.com/GHQgTRWYB5
December 25
Sometimes you may wish to open files, directories, URLs, etc. programmatically, instead of doing it manually.
β R Function A Day (@rfunctionaday) December 25, 2021
The {xopen} function from the eponymous π¦ provides a way to so from R! π§https://t.co/5HxeOdvIIK#rstats #DataScience pic.twitter.com/zVpcSHOdXe
December 26
If you use {R6}βs implementation of encapsulated OOP in R, and sometimes you may wish to use more idiomatic functional OOP with such objects.
β R Function A Day (@rfunctionaday) December 26, 2021
The eponymous function from {R62S3} π¦ generate S3 generics/methods for R6 classes πhttps://t.co/s82kX21cKc#rstats #DataScience pic.twitter.com/DCXfB6wpgu
December 27
A Tufte handout is a thoughtfully styled document with footnotes, integration of graphics with text, and elegant typography.
β R Function A Day (@rfunctionaday) December 27, 2021
The {tufte_*} function family from {tufte} π¦ helps create them via Rmarkdown πhttps://t.co/Ca2FPorPnW#rstats #DataScience pic.twitter.com/dhyEsyj1l7
December 28
Archive files (zip, tar, etc.) collect multiple files in a single file, and you may sometimes need to use them for portability or compression.
β R Function A Day (@rfunctionaday) December 28, 2021
The {archive_*} function family from {archive} π¦ provides relevant operations in R! πhttps://t.co/E97cRlKZrO#rstats #DataScience pic.twitter.com/a1GlbccJfV
December 29
YAML language is ubiquitous, especially in configuration files, and sometimes we may wish to convert R object to a YAML string.
β R Function A Day (@rfunctionaday) December 29, 2021
The {as.yaml} function from {yaml} π¦ makes this easy πhttps://t.co/31Iwor6B6N#rstats #DataScience pic.twitter.com/S3YfVZovnD
December 30
Cox regression model is widely used in medical research to assess the effect of several risk factors on the survival time of patients.
β R Function A Day (@rfunctionaday) December 30, 2021
The {ggforest} function from {survminer} π¦easily creates a forest plot of its model estimates πhttps://t.co/YXA8LjVQY5#rstats #DataScience pic.twitter.com/S6F2KdFAUn
December 31
While crawling webpages, sometimes you may wish to switch between linking strategies; using either absolute or relative URLs.
β R Function A Day (@rfunctionaday) December 31, 2021
The {url_*} function family from {xml2} π¦ makes these conversions easy in R! πhttps://t.co/x1KW07bqQZ#rstats #DataScience pic.twitter.com/8cZaZ6afiy