• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Rstats 101

Learn R Programming Tips & Tricks for Statistics and Data Science

  • Home
  • About
    • Privacy Policy
  • Show Search
Hide Search

How to randomly select rows from a dataframe in R

rstats101 · January 25, 2022 ·

How to randomly select rows from a dataframe in R

In this tutorial, we will learn how to randomly select rows from a dataframe using dplyr's slice_sample() function in R. slice_sample() is the new way to randomly select rows either with replacement or without replacement and it supersedes an earlier function sample_n() in … [Read more...] about How to randomly select rows from a dataframe in R

Filed Under: dplyr slice_sample() Tagged With: randomly sample rows in R, randomly select rows from a dataframe

dplyr row_number(): Add unique row number to a dataframe

rstats101 · January 23, 2022 ·

How to add row number to a dataframe in R

In this tutorial, we will learn how to add unique row number to each row to a dataframe/tibble. We will use dply'r row_number() function to add unique row number as acolumn to a dataframe using tidyverse first. Then we will also see an example of adding a row number to a … [Read more...] about dplyr row_number(): Add unique row number to a dataframe

Filed Under: dplyr row_number() Tagged With: dplyr add row number

How to Replace NAs with Column mean using tidyverse

rstats101 · January 20, 2022 ·

How to Replace NAs with column means using tidyverse

In this tutorial, we will learn how to replace missing values NAs in a data set with column means using tidyverse functions. Dealing with missing data is very important in doing data analysis. Understanding the origin of missing values NAs is very important to make a decision on … [Read more...] about How to Replace NAs with Column mean using tidyverse

Filed Under: replace NA, replace NAs tidyverse, tidyverse Tagged With: replace NA with column mean, replace NAs with mean tidyverse

How to Replace NA values with Column Mean

rstats101 · January 14, 2022 ·

One of the ways to deal with missing values (or NAs) is to replace them with mean values (under certain assumptions). The process is called imputation. In this tutorial, we will learn how to replace missing values (NAs) with column mean. First we will create some data with … [Read more...] about How to Replace NA values with Column Mean

Filed Under: impute with mean values, replace NA Tagged With: Replace NAs with column mean

colSums in R – compute sum of all columns in a dataframe or matrix

rstats101 · January 12, 2022 ·

In this tutorial, we will learn about colSums() function in base R and use it to calculate sum of all columns in a matrix or a dataframe. We will see two examples to understand the use colSums() function. First, we will calculate sum of all columns in a matrix and dataframe with … [Read more...] about colSums in R – compute sum of all columns in a dataframe or matrix

Filed Under: colSums() R Tagged With: Sum of Columns in R

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 18
  • Page 19
  • Page 20
  • Page 21
  • Page 22
  • Interim pages omitted …
  • Page 24
  • Go to Next Page »

Primary Sidebar

Recent Posts

  • How to create a nested dataframe with lists
  • How to compute proportion with tidyverse
  • How to Compute Z-Score of Multiple Columns
  • How to drop unused level of factor variable in R
  • How to compute Z-score

Categories

%in% arrange() as.data.frame as_tibble built-in data R colSums() R cor() in R data.frame dplyr dplyr across() dplyr group_by() dplyr rename() dplyr rowwise() dplyr row_number() dplyr select() dplyr slice_max() dplyr slice_sample() drop_na R duplicated() gsub head() impute with mean values is.element() linear regression matrix() function na.omit R NAs in R near() R openxlsx pivot_longer() prod() R.version replace NA replace NAs tidyverse R Function rstats rstats101 R version scale() sessionInfo() t.test() tidyr tidyselect tidyverse write.xlsx

Copyright © 2025 · Daily Dish Pro on Genesis Framework · WordPress · Log in

Go to mobile version