R Programming Language was built for Statistics and data analysis which means it has many functions available for this purpose. The function which were already defined in the programming framework. R has a set of function which can be used to perform almost every task for the users.

## String Function

Function | Description |

substr(x, start=n1,stop=n2) | It is used to extract or replace substrings in a character vector. |

grep(pattern, x , ignore.case=FALSE, fixed=FALSE) | It is used for searching for pattern in x. |

sub(pattern, replacement, x, ignore.case =FALSE, fixed=FALSE) | It is used for finding pattern in x and replaces it with replacement text. |

paste(..., sep="") | It is used for concatenation of strings after using sep string to separate them. |

strsplit(x, split) | It is used for splitting the elements of character vector at splitting points. |

tolower(x) | It is used to convert strings to lower case. |

topper(x) | It is used to convert strings to upper case. |

## Numeric Functions

Functions | Description |

abs(x) | It is used to return the absolute value of x. |

sqrt(x) | It returns the square root of the x. |

ceiling(x) | It returns the smallest integer value which is larger than or equal to x. |

floor(x) | It returns the largest integer value which is smaller than or equal to x. |

trunc(x) | It is used for performing truncate of the value x. |

round(x, digits=n) | It returns the round value of x. |

cos(x), sin(x), tan(x) | It is used to return the cos ,sin or tan values of x. |

log(x) | It gives natural logarithm. |

log10(x) | It gives the common logarithm. |

exp(x) | It returns exponent. |

## Statistical Probability Functions

Function | Description |

dnorm(x, m=0, sd=1, log=False) | It is used for finding the height at each point to a given mean and standard deviation of a probability distribution. |

pnorm(q, m=0, sd=1, lower.tail=TRUE, log.p=FALSE) | It is used to find cumulative normal probability for q |

qnorm(p, m=0, sd=1) | It is used to find a number whose cumulative value is same as the probability value. |

rnorm(n, m=0, sd=1) | It is used to generate random numbers with normal distribution. |

dbinom(x, size, prob) | It return the probability density distribution at each point. |

pbinom(q, size, prob) | It return the cumulative value whose probability value is same. |

rbinom(n, size, prob) | It return numbers of random values of a given probability from a given sample. |

dpois(x, lamba) | It is used to find the probability of x successes in a period when the expected number of events is lambda. |

ppois(q, lamba) | It is used to find cumulative probability of less than or equal to q successes. |

rpois(n, lamba) | It return random numbers from the poisson distribution. |

dunif(x, min=0, max=1) | It provide information about the uniform distribution on the interval from min to max. It gives the density. |

punif(q, min=0, max=1) | It return the distributed function |

qunif(p, min=0, max=1) | It return the quantile function |

runif(x, min=0, max=1) | It generates random deviates |

## Other Statistical Function

Function | Description |

mean(x, trim=0, na.rm=FALSE) | It return the mean for x. |

sd(x) | It return the standard deviation of the object. |

median(x) | It return the median for x |

quantilie(x, probs) | It return quantile where x is the numeric vector whose quantile are desired and prob is a numeric vector with probabilities in [0,1] |

range(x) | It return range. |

sum(x) | It return sum. |

diff(x, lag=1) | It return lagged differences, with lag indicating which lag to use. |

min(x) | It return minimum value. |

max(x) | It return maximum value. |

scale(x, center=TRUE, scale=TRUE) | It is used to standardize a matrix. |

- Log in to post comments