R-Package Advent Calendar 2020

R-Package Advent Calendar 2020

This year, I started a Twitter advent calendar showcasing one R-package per day, each of which I find essential for my work. The aim is to highlight useful packages, both familiar and lesser-known, and offer insights into their functionalities. Follow along to discover packages from CRAN, BioConductor, GitHub, and more, and perhaps find new tools to enhance your work.

This year has been truly something different for us all. Blogging has definitely taken a toll, as real life has been quite something to handle. So, in order to end the year with a bang, and something fun, I started a twitter advent calendar!

The advent calendar is one R-package per day that I personally use and find very useful in my work. The hope is that it would give people a mix of familiar and less familiar packages that might help their work too. In each package sub-thread, I try to highlight some functions or functionality from the various packages that I like in particular. There are so many packages on CRAN and other online repositories (BioConductor, GitHub, Gitlab, NeuroConductor etc.), that it can be hard to find something to help you along. I hope this atleast points you in a good direction. There are other packages that could cover some or all of the same functionality as the ones listed here, but these are the ones I personally use.

How I selected a package per day

Before I started the calendar (one day late!), I sat down and wrote a list of all the packages I wanted in my advent calendar.

The rules were:

  • One package per day
  • I must personally use it
  • I can find easy examples of why I like using it

The point of the calendar was to do something fun, that others might find useful, and that would highlight and give credit to great packages. But I also did not have the possibility of spending lots of time researching other alternative options or the like, it was to be a light-weight and easy thing for me to do.

So i wrote down my list in R:

pks <- c("usethis", "rio", "distill", 
         "boom", "patchwork", "holepunch",
         "learnr", "xaringan", "magick",
         "nettskjemar", "pkgdown", "here",
         "rticles", "vitae", "xaringanExtra",
         "stringr", "forcats", "lubridate", 
         "glue", "janitor", "pbmcapply",
         "kableExtra", "papayar", "reactable")

Then I made a little function that would draw a random one every time I ran it, while omitting the ones I had drawn before

get_todays <- function(completed, pkgs){
  days <- 1:24
  days <- days[!days %in% completed]
  k <- sample(days, 1)  
  cat(pkgs[k], "\n")
  k
}

Now I had an itty bitty function that would draw from my list by random each day, so I did not have to think about the order of things. Every day I drew a new package, tweeted about it, and added it to the completed list.

completed <- c(3, 12, 19, 6, 8, 1, 
               10, 16, 22, 5, 
               17, 21, 18, 9, 7)

get_todays(completed, pks)
## rticles
## [1] 13

Now, there is a slight problem with my function. I forgot to add a random seed, as pointed out by Tobias Busch

So, always room for improvement! If I do something similar next year, I’ll be sure to add that!

Have a great Christmas, everyone!

  • Dec 06, 2019

    ggseg3d - creating interactive brain segmentation plots with plotly

    Discover how to create interactive 3D brain atlas plots using the ggseg3d package in R. Learn to visualize neuroimaging data with plotly, including setting up and customizing brain atlas plots. Ideal for neuroscientists and data scientists working with brain segmentation data.

    Read
    packages
    neuroimaging
    plots
    r
  • Oct 01, 2018

    Get the brain animated!

    Explore how to create animated visualizations of brain data using the ggseg and gganimate packages in R. Learn to prepare data for animations, customize plots, and generate smooth transitions to visualize changes across different conditions such as age.

    Read
    packages
    neuroimaging
    r
  • Aug 30, 2018

    Introducing the ggseg R-package for brain segmentations

    Discover ggseg, an R package designed for plotting brain segmentations directly in R with ggplot2. Learn how to visualize results from different brain atlases, customize plots, and integrate your own data. Ideal for neuroimaging researchers needing to plot segmented brain data efficiently.

    Read
    plots
    packages
    neuroimaging
    r
  • Jun 24, 2020

    The Linear Regression Family in R

    Linear regression is essential in psychology, often disguised as t-tests or ANOVAs. This guide explains running linear models in R, comparing t-tests, Pearson correlations, ANOVAs, ANCOVAs, and more. Understand how to specify models, run tests, and interpret them with real data examples. Gain confidence in translating your hypotheses into linear models and applying statistical methods effectively.

    Read
    r
    analysis
    linear-regression
  • May 25, 2020

    Changing your Blogdown Workflow

    Updating my hugo setup on netlify took over a year of delays due to complexities. After extensive work, I transitioned from knitting .html to .md, fixed theme issues, and resolved netlify CSS problems. Follow my step-by-step guide to smoothly update your blogdown website. Learn to make use of hugo’s page bundles, adjust configurations, and ensure seamless rendering both locally and on netlify. This guide addresses key changes you might face, from altering your workflow to understanding theme changes and troubleshooting rendering issues.

    Read
    r
    hugo
    blogdown