How to add currency symbols to columns of a table with gt()

In this tutorial, we will learn how to add currency symbols, like US dollars, Euro, UK pound, Indian Rupee to columns of a table using the R package gt. Let us load gt package to make beautiful tables and tidyverse. First we will create a simple dataframe/tibble with stock prices of a few companies in… Continue reading How to add currency symbols to columns of a table with gt()

runif()- generate uniform random numbers

One way to generate uniformly distributed numbers in R is use the runif() function. runif is short for “random uniform”. R has other random number generating functions. For example rnorm generates random normal numbers. runif() takes three arguments, thrst is n – number of numbers we want and min and max for generating numbers between… Continue reading runif()- generate uniform random numbers

How to Find difference between two dates as days, weeks, months and years

In this tutorial we will learn how to find the difference between two date objects in R in terms of days, months, and years. We will learn how to use time_length() function available in tidyverse as part of lubridate package to get the difference as dyas, weeks, months, and years. Let us create two date… Continue reading How to Find difference between two dates as days, weeks, months and years

dplyr’s anti_join() to find rows based on presence or absence in a dataframe

In this tutorial, we will learn how to use dplyr’s anti_join() function to filter rows from one dataframe based on the presence or absence of matches in another dataframe. dplyr’s anti_join() function is extremely useful for cases when we want to find what row is present or missing in a dataframe when compared to another… Continue reading dplyr’s anti_join() to find rows based on presence or absence in a dataframe

tidyr’s separate_delim_wider(): Split a string into columns

In this tutorial, we will learn how to split a string in a column into multiple columns using a delimiter. We will use tidyr’s separate_delim_wider() function, that separates a string in a column into multiple columns using delimiter. After spliting the dataframe is wider with more columns. We will start with a simple example of… Continue reading tidyr’s separate_delim_wider(): Split a string into columns

Exit mobile version