One of the ways to deal with missing values (or NAs) is to replace them with mean values (under certain assumptions). The process is called imputation. In this tutorial, we will learn how to replace missing values (NAs) with column mean. First we will create some data with missing values and then show how to… Continue reading How to Replace NA values with Column Mean
colSums in R – compute sum of all columns in a dataframe or matrix
In this tutorial, we will learn about colSums() function in base R and use it to calculate sum of all columns in a matrix or a dataframe. We will see two examples to understand the use colSums() function. First, we will calculate sum of all columns in a matrix and dataframe with no missing values… Continue reading colSums in R – compute sum of all columns in a dataframe or matrix
How to Replace NA values in a dataframe with Zeros?
In this tutorial, we will learn how to replace all NA values in dataframe with a specific value like zero in R. Create a dataframe with NA values Let us get started with creating a dataframe with missing values,i.e. NAs in columns. We first create a vector with NAs using sample() function, where we sample… Continue reading How to Replace NA values in a dataframe with Zeros?
head() in R to view the first elements
head() function in R is one of the most useful functions that lets you quickly get a peek at the data you have in a R object. Using head() function in R, you can view the first elements in a vector, matrix, dataframe and other R objects. In this tutorial, we will use head() function… Continue reading head() in R to view the first elements
How to find installed R version from RStudio
In this tutorial, you will learn three different ways to identify the version of R installed in your computer. Find R version from console after opening RStudio One of the ways to find the R version that you are using is to look at the console when you open R either using R app or… Continue reading How to find installed R version from RStudio