summary() Function: Producing Summary Statistics in R

R summary() Function

The summary() is a generic function that produces the summary statistics for various R objects, including vectors, matrices, data frames, and model objects. The above figure explains the summary for a data frame with three columns. For different types of objects, the summary() function produces different types of summaries: If the input is numeric, it … Read more

How to Calculate Standard Error in R

How to Calculate Standard Error in R

Standard Error (SE) measures the variability or dispersion of the sample mean estimate of a population mean. Here are three ways to calculate standard error in R: Using sd() with length() Using the standard error formula Using std.error() from plotrix package Here is the basic formula: where: σ = sample standard deviation n = sample … Read more

R pnorm() Function [With Graphical Representation]

R pnorm() Method

The pnorm() function in R calculates the cumulative density function (cdf) value of the normal distribution given a specific random variable q, the population mean μ, and the population standard deviation σ. It returns the probability that a normally distributed random variable is less than or equal to a given value. It provides the probability … Read more

How to Set and Get Working Directory [setwd() and getwd()] in R

setwd() and getwd() in R

Set the current working directory The setwd() function sets the working directory to the new location, allowing us to change the default location for file operations. The working directory is a location where R looks for files to read or save by default. Use absolute paths for reliability, relative paths for flexibility. Syntax setwd(dir) Parameters … Read more

R dnorm(): Probability Density Function

dnorm() in R

The dnorm() function in R calculates the value of the probability density function (pdf) of the normal distribution of a given value or vector of values. It determines the probability density of a continuous random variable following a normal distribution, characterized by a mean (μ) and standard deviation (σ). How do you define the normal … Read more

Understanding of rnorm() Function in R

What is rnorm() function in R

The rnorm() method in R generates random numbers from a normal (Gaussian) distribution, which is characterized by a bell-shaped curve defined by its mean and standard deviation, which are widely used in statistical simulations and data analysis. To understand in simple terms, let me take an example.  Let’s say I want to select some candies. … Read more

cbind() Function: Binding R Objects by Columns

cbind() Method in R

R cbind() (column bind) is a function that combines specified vectors, matrices, or data frames by columns, creating a new matrix or data frame where the input objects are placed side by side. Syntax cbind(…, deparse.level = 1) Parameters Argument Description … It represents the objects that we need to combine column-wise. It can be … Read more

rbind() Function: Binding Rows in R

R rbind() method

The rbind() function combines R objects, such as vectors, matrices, or data frames, by rows. It stacks rows vertically. The above figure illustrates how the rbind() method works on data frames, combining their rows. The data frame that is being stacked must have the same number of columns (or elements, in the case of vectors), … Read more