• 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 Split a Dataframe into a list of Dataframes by groups in R

rstats101 · April 21, 2022 ·

In this tutorial, we will learn how to split a dataframe into a list of dataframes by groups in R. We will first learn how to use the base R function, split(), to divide a dataframe into multiple dataframes into a list. Then, we will learn how to use dplyr's group_split() … [Read more...] about How to Split a Dataframe into a list of Dataframes by groups in R

Filed Under: dplyr group_split(), split() Tagged With: split a dataframe into list dataframes by group

How to sum a column by group in R

rstats101 · April 17, 2022 ·

How to sum a column by group in R

In this tutorial, we will learn how to compute the sum of a column by groups in another column in a dataframe. Basic, idea is to group the dataframe by the grouping variable/column and then find the sum for each group. Let us get started by loading tidyverse suite of R … [Read more...] about How to sum a column by group in R

Filed Under: dplyr group_by(), dplyr summarize() Tagged With: Calculate sum by group in R, Sum a column by group dplyr

How to extract a column of a dataframe as a vector in R

rstats101 · April 15, 2022 ·

Extract A Column As Vector in R

In this tutorial, we will learn how to extract a column from a dataframe in R. We will extract a column as a vector using base R method and then see multiple examples of using dplyr's pull() function to extract a column from a dataframe. Getting Ready with Packages and Data … [Read more...] about How to extract a column of a dataframe as a vector in R

Filed Under: dplyr, dplyr pull() Tagged With: extract a column as vector

How to number rows within a group in dataframe

rstats101 · January 27, 2022 ·

How to add row number with each group of a dataframe in R

In this tutorial, how to add numbers to rows with in each group in a dataframe in R. The picture below illustrates an example of adding row numbers per group. Packages And Data We will first create sample dataframe using tibble function and then use dplyr's functions to add … [Read more...] about How to number rows within a group in dataframe

Filed Under: dplyr, dplyr n(), dplyr row_number() Tagged With: numbering rows to each group in a data frame

dplyr count(): count unique values of a variable

rstats101 · January 26, 2022 ·

In this tutorial, we will learn how to count unique values of a variable(s) or column using dplyr's count() function. dplyr's count() function is a convenient function that combines grouping operation and counting the number of observation in each group. We will learn of 4 … [Read more...] about dplyr count(): count unique values of a variable

Filed Under: dplyr count() Tagged With: Count unique values of a variable, dplyr count unique values

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 17
  • Page 18
  • Page 19
  • Page 20
  • Page 21
  • 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