Join dataframes by different column names with dplyr

Join dataframes by different column names with dplyr

In this tutorial, we will learn how to join dataframes by columns with different names in the two dataframes. dplyr offers a great set of tools to join or merge dataframes. We will use two approaches to merge two dataframe by different names. We will start with loading tidyverse. Then we will create two toy… Continue reading Join dataframes by different column names with dplyr

slice_max: get rows with highest values of a column

dplyr's slice_max(): Rows with highest values for a column

In this tutorial, we will learn how to get rows with maximum values of a column or variable from a dataframe. For example, from a dataframe with multiple rows and columns we will find a row (or multiple rows) with maximum values for a column. We will use dplyr’s slice_max() function to select rows with… Continue reading slice_max: get rows with highest values of a column

Logistic Regression with Single Predictor in R

Plotting logistic regression model with geom_smooth()

In this post, we will learn how to perform a simple logistic regression using Generalized Linear Models (glm) in R. We will work with logistic regression model between a binary categorical variable as response variable and a single numerical predictor. Data for logistic regression Let us load the packages needed. We will use two variables… Continue reading Logistic Regression with Single Predictor in R

Simple Barpots and reordering bars in R

Reorder barplot by a variable using fct_reorder()

In this post, we will learn how to make simple barplot using ggplot2 and learn to reorder barplots in R. We will make a barplot using ggplot2’s geom_col() with multiple bars. By default, ggplot2 orders the bars in alphabetical order. We will see examples of reordering barplots by another numerical variable in the data using… Continue reading Simple Barpots and reordering bars in R

Exit mobile version