R switch: How to use switch() function in r

R Switch - How to Use switch() Function in R

A switch statement enables a variable to be tested for equality against a list of values. The value of the switch() function is called a case, and the variable being switched on is checked for each case. The nested if…else statement in R is exceptionally beneficial when you need to execute a particular code block when the … Read more

Standard deviation in R: How to Use sd() in R

How to Calculate Standard Deviation in R using sd()

We have already seen how to calculate percentile and variance in R programming. We have also seen how to calculate Mean and Mode in R. Let’s see how to compute the standard deviation, but before that, let’s understand what SD is. What is Standard Deviation The standard deviation of a population is the square root of … Read more

cbind in R: How to Bind Data Frame By Columns

cbind in R - How to Bind Data Frame By Columns

The cbind() and rbind() functions are generic methods for data frames. These data frame functions will be used if at least one argument is a data frame and the other are vectors or matrices. To merge two data frames (datasets) horizontally, use the merge() function in the R language. cbind in R The cbind short for column … Read more

dnorm in r: What is dnorm() function in r

dnorm() Function in R with Example

The dnorm() function gives the density. The pnorm() function gives the distribution function. The qnorm() function gives the quantile function. The rnorm() function generates random deviates. dnorm in r The dnorm in r is a built-in function that calculates the density function with a mean(μ) and standard deviation(σ) for any value of x, μ, and σ. … Read more

How to Use Dollar sign in R

Dollar sign in R with Example

There are four forms of the extract operator in R: [, [[, $, and @. The fourth form is the slot operator and is used to extract content from objects built with the S4 object system, also known as a formally defined object in R. Most beginning R users don’t work with formally defined objects … Read more

scatterplot in r: How to create scatterplot in r

How to Create Scatter Plot in R with Example

Graphs and charts are visual representations of the data. If you are working in the data science field, your goal is to make sense of the large data. The data analysis contains three processes. Data Extraction Cleaning and manipulating the data Create a graph or chart of the gathered data to analyze further. Graphs and … Read more

exp function in R: How to Calculate Exponential Value

R exp() Method with Example

To create an exponential function, you let the independent variable be the exponent. Exponential functions are solutions to the simplest types of dynamical systems. The Natural Exponential Function equation is the following. Where e is “Eulers Number” = 2.718281828459 An exponential function can describe growth or decay. For example, the exponential decay function can be described … Read more

grep in R: How to Use grep() Function in R

grep in R - How to Use grep() Function in R

Suppose we wanted to identify the records for all the victims of floods in China. How could we do that? Here I use grep() to match the literal into the character vector of flooded victims. Let’s see how to use the grep() method and the difference between grep() and grepl() functions. grep in R The … Read more

sample function in R: The Complete Guide

sample() Function in R with Example

Statisticians usually need to take the samples of the dataset and then calculate the statistics. Taking a sample is easy with R because of the sample() method, as it is nothing more than a subset of data.  sample function in R The sample in R is a built-in function that takes a sample of the … Read more