How to Replace NA values in a dataframe with Zeros?

How to replace all NAs 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?

How to find installed R version from RStudio

How to find the version of R using version command

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

gsub() in R to replace all matching patterns

In this tutorial, we will learn about gsub() function in R to replace all matching patterns in a string. gsub, stands for “global substitution” is similar to another function R, sub(), but for substituting all matching patterns, not just the first one. Here is a typical use of gsub() in R. We need to provide… Continue reading gsub() in R to replace all matching patterns

dplyr near(): compare if numbers and vectors are nearly the same

In this tutorial, we will learn near() function part of R package dplyr to check the equality of two numbers or vectors. Often we would like to compare if two numbers or two vectors are equal. A naive approach of using == to compare if two numbers are equal can be problematic due to machine… Continue reading dplyr near(): compare if numbers and vectors are nearly the same

Exit mobile version