rp_count: Count rows in a data frame, optionally by groups

View source: R/verbs_filter.R

rp_countR Documentation

Count rows in a data frame, optionally by groups

Description

This function returns the number of rows in a data frame. When grouping variables are provided via .by, it returns the row counts for each group.

Usage

rp_count(.data, .by = NULL, table_name = NULL, return.as = "result")

Arguments

.data

An R data frame (or tibble) to be processed.

.by

Optional grouping variables. Can be one or more unquoted column names (e.g., cut or c(cut, color)). When provided, counts are computed per group.

table_name

An optional character string. If provided, the generated Python code will replace the internal dataframe name with this string (e.g., "diamonds.query(...)"). This is useful for seeing the exact, copy-pasteable Python code. Defaults to NULL (uses "df").

return.as

One of "result", "code", or "all".

Value

A data frame with one column "n" (total row count) if .by = NULL, or a data frame with the grouping columns and a column "n" (per‑group counts).


rPandas documentation built on April 29, 2026, 1:07 a.m.