• About Me
  • Contact Me
  • Cookie Policy (EU)

Data Cornering

  • Twitter
  • Facebook
  • LinkedIn
  • Bar chart race in R using ggplot2 and gganimate

    Bar chart race in R using ggplot2 and gganimate

    Here is a relatively simple way to create a bar chart race in R – bar chart with bars overtaking each other. An attractive data visualization to engage your auditory while showing how the situation unfolds. Using the ggplot2 and gganimate, you can create a bar chart race in R and adjust the dynamics of […]

    March 26, 2023

    in

    R, RDataViz
  • Unpivot data in R with the pivot_longer from tidyr

    Unpivot data in R with the pivot_longer from tidyr

    Here are multiple examples with the pivot_longer from tidyr, which is an excellent choice if you want to unpivot data in R and transform the data frame from wide to long.

    March 24, 2023

    in

    R
  • Pivot data in R, like in Excel PivotTable, from long to wide

    Pivot data in R, like in Excel PivotTable, from long to wide

    Here is how to pivot data in R from long to wide format and increase the number of columns. This transformation might be familiar to Microsoft Excel users because of the PivoTable tool. It might not be the most commonly used data transformation, but sometimes necessary to show data in a small table or transform […]

    March 18, 2023

    in

    R
  • How to generate random dates or numbers in R

    How to generate random dates or numbers in R

    Here is how to generate random dates or numbers in R by using base functions. There are similarities in both of the tasks, and they are useful in creating reproducible examples.

    March 17, 2023

    in

    R
  • How to create a simple heatmap in R ggplot2

    How to create a simple heatmap in R ggplot2

    Here is how to quickly build a heatmap in R ggplot2 and add extra formatting by using a color gradient, data labels, reordering, or custom grid lines. There might be a problem if the data contains missing values. At the end of this post is an example of how to deal with NA values in […]

    February 26, 2023

    in

    R, RDataViz
  • Count by group in R using base, dplyr, and data.table

    Count by group in R using base, dplyr, and data.table

    Here are multiple examples of how to count by group in R using base, dplyr, and data table capabilities. Dplyr might be the first choice to count by the group because it is relatively easy to adjust to specific needs. Meanwhile data.table is good for speed, and base R sometimes is good enough.

    February 25, 2023

    in

    R
  • How to determine if the number is even or odd in R

    How to determine if the number is even or odd in R

    You can tell if the number is even or odd in R programming by looking at the reminder after the number is divided by 2. If the remainder equals 0, it is an even number, otherwise, it is an odd number. There is a nifty way to get the reminder after division in R by […]

    February 25, 2023

    in

    R
  • Keep trailing zeros in R ggplot2 geom_text

    Keep trailing zeros in R ggplot2 geom_text

    If you want to keep trailing zeros in R, and in particular for text labels in ggplot2 geom_text, try functions like sprintf, formatC, or digits from the formattable package. Add trailing zeros in the R data frame, ggplot2, and keep numerical properties using the function digits from the formattable.

    February 19, 2023

    in

    R, RDataViz
  • Replace the first occurrence of a character or string in R

    Replace the first occurrence of a character or string in R

    Here is how to find and replace the first occurrence of a character or string in R. It will help you to separate words in multiple lines in ggplot2 visualizations or do other tasks.

    February 18, 2023

    in

    R
  • Count excluding NA in R

    Count excluding NA in R

    If you want to count values excluding NA in R, here is a simple way to do that. You can detect non-NA values and get results as TRUE or FALSE that can be used by the sum function to get the result.

    February 17, 2023

    in

    R
Older Posts→


Data Cornering

Copyright © Data Cornering All Rights Reserved

Proudly powered by WordPress

Manage Cookie Consent
We use technologies like cookies to store and/or access device information. We do this to improve browsing experience and to show personalised ads. Consenting to these technologies will allow us to process data such as browsing behaviour or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}