R View() Function

R View() Function

The View() is a utility function in R that invokes a more intuitive spreadsheet-style data viewer on a matrix-like R object. View() does not print output in the console or return a value — it is a side-effect function that launches a separate data viewer window. It is ideal for quickly checking data contents, identifying patterns, or … Read more

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