In this tutorial we will learn how to add a prefix or a suffix to column names of a data frame in R. We will use dplyr’s rename_with() function to add prefix/suffix to column names. dplyr’s rename_with() function belongs to another renaming function in dplyr, rename() that is useful. for renaming a individual columns. First,… Continue reading How to add Prefix/Suffix to Column Names of a dataframe in R
Category: rstats101
How to Measure Running Time in R (with two examples)
In this tutorial, we will learn how to measure execution time in R. We will learn two ways, using Sys.time() and system.time, of measuring execution time in R. Both the methods to measure running time are readily available in base R and do need use any outside R packages. Measuring Execution Time with Sys.time() We… Continue reading How to Measure Running Time in R (with two examples)
dplyr arrange: Sort rows by one or more variables
In this tutorial, we will learn how to sort a dataframe by one or more columns using dplyr’s arrange() function. dplyr’s arrange() function is one of the important functions in dplyr that lets you use dplyr to sort rows. By sorting, we mean dplyr’s arrange() changes the order of the rows. based on. the values… Continue reading dplyr arrange: Sort rows by one or more variables
How to use cbind() function in R
In this tutorial, we will learn how to use cbind() function in R. The cbind() function in the R programming language is used to combine vectors, matrices, or data frames by columns. cbind() stands for column bind as it combines by column. The basic syntax for using cbind() is as follows: Here, x and y… Continue reading How to use cbind() function in R
How to use outer function in R
In this tutorial, we will learn how to use outer() function in R. The outer() function in R is a useful tool for applying a function to all pairs of elements of two input vectors. The basic syntax of using outer() function is this Here X and Y are vectors and default function to the… Continue reading How to use outer function in R