In this post, we will learn how top perform t test in R and understand when and why to use it. A t-test is one of the commonly used statistical tests, when one is interested in comparing two groups of measures and determine if there is a significant difference between the mean values of two… Continue reading How to perform t-test in R
expand_grid(): Create all possible combinations of variables
In this tutorial, we will learn how to create all possible combinations of two variables using tidyr’s expand_grid() function. For example, if we have two variables of interest and want to create a dataframe with all possible combinations of the values of the two variables, we can use expand_grid() function. let us get started by… Continue reading expand_grid(): Create all possible combinations of variables
How to convert a list to a dataframe
In this tutorial, we will learn 3 different ways to convert a list object into a dataframe in R. First we will show how to use the base R function as.data.frame() to convert a list to a dataframe. Then we will show examples using map_df() function in purrr package in tidyverse and bind_rows() function in… Continue reading How to convert a list to a dataframe
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