In this tutorial, we will learn how to use outer() function in R. The outer() function in R is a useful tool for applying a function to all pairs of elements of two input vectors. The basic syntax of using outer() function is this Here X and Y are vectors and default function to the… Continue reading How to use outer function in R
Category: R Function
How to compute mean in R
In this tutorial, we will learn how to use mean() function in R to compute mean (or average) of a vector. In the most basic use case, mean() function takes a vector as input argument and computes arithmetic mean of the elements in the vector In R, we can learn more about the function with… Continue reading How to compute mean in R
How to remove columns with all NAs
In this tutorial, we will learn how to drop columns with values that are all NAs. We will use two approaches to remove columns with all NAs. First, we will use tidyverse approach, where we perform column-wise operation to see all values are NAs and select columns that are not all NAs. Next we will… Continue reading How to remove columns with all NAs
How to Extract p-values from multiple simple linear regression models
Sometimes you might fit many simple linear regression models and would like to extract p-values from each model. In this tutorial, we will learn two approaches to extract p-values from multiple simple linear regression models built in R. We will first use for loop to build and extract pvalue from multiple linear models and then… Continue reading How to Extract p-values from multiple simple linear regression models
list.files() in R: list files in a directory
In tutorial, we will learn how to list all the files in a directory in R. With list.files() function in R we can get all the files in a folder or directory as a vector. Here we will see multiple examples of using list.files() to get the files in a directoy, files matching a pattern… Continue reading list.files() in R: list files in a directory