Category: R

  • Script progress bar in R that works with purrr and in batch mode

    Script progress bar in R that works with purrr and in batch mode

    Here is how to create a progress bar in R that is versatile when working with loops, for example, by using package purrr or the function lapply. Sometimes there is also necessary to see progress when running R scripts in batch mode from the command line and remove unnecessary messages.

  • How to suppress package loading messages in R or warnings

    How to suppress package loading messages in R or warnings

    If you want a cleaner look while running your code in interactive or batch mode, try to suppress package loading messages in R. There are also possible to disable some of the warnings. It is typically at the loading of chatty packages like dplyr or janitor. Of course, they have helpful information, and you should…

  • How to combine Excel files in R, including transformations

    How to combine Excel files in R, including transformations

    Here are two quick solutions to combine Excel files in R with the necessary transformations. Fundamentally it is a similar approach that I used to combine multiple RDS files in R.

  • Get file location in R

    Get file location in R

    Here are multiple scenarios on how to get file location in R. It can be a directory or a full path, and sometimes there are specific file types that you want to detect. A typical use case is when combining data from multiple files, for example, rds files or other formats.

  • How to do something across columns in R using dplyr

    How to do something across columns in R using dplyr

    If you know how to efficiently do calculations across columns in the R data frame it can save you a lot of time. One of the best ways to do that with data frames is by using the across function from dplyr.

  • How to get the weekday name from the date or number in R

    How to get the weekday name from the date or number in R

    There are multiple scenarios where you would like to get the weekday name from the date or number in R. Here are four solutions to get that depending on available content. The weekday number might already be in a separate column or obtainable from the date. It is not so easy as getting the month…

  • How to create gradient shade under the line chart in R

    How to create gradient shade under the line chart in R

    Here is how to create a vertical gradient shade under a line chart in R. It is a trickier task than using the gradient effect in a line chart or word cloud. Actually, it is a gradient area chart with accented line. In the beginning, I was looking at this from somehow a weird perspective.

  • Mean by a group in R

    Mean by a group in R

    Here is how to calculate the mean by a group in R. If you are an Excel, user you might prefer to say average by a group in R. This post contains multiple scenarios that will ensure that you know some of the pitfalls and tricks.

  • How to get the month name from the number in R

    How to get the month name from the number in R

    There are multiple scenarios where you would like to get the month name from the number in R. Here are two solutions to get that depending on the month number location. The month number might already be in a separate column or date.

  • How to add glow effect in R plot

    How to add glow effect in R plot

    The glow effect in the R plot might be one of those adjustments that someone uses rarely. Meanwhile, neon luminescence adds a special feel to the diagram. Almost like from sci-fi movie. Here is how to add the glow effect in the R plot by using two solutions.