Skip to main content
v2026.11,858 entries · CC-BY 4.0

Conditional Relative Frequency Table: How to Build One

How to build and read a conditional relative frequency table: the row and column formulas, worked examples, rounding, and Excel, R and Python code.

Written and maintained by CASRAI Editorial Board

Last updated

A conditional relative frequency table turns the counts in a two-way table into proportions inside one group: each cell is divided by the total of its own row or its own column, not by the grand total. The choice of row or column decides which question the table answers, and it is the step most often done in the wrong direction.

What a conditional relative frequency table shows

A table that summarises two categorical variables is called a contingency table (OpenIntro, Introduction to Modern Statistics, “Exploring categorical data”). Row proportions are the counts divided by their row totals; column proportions are the counts divided by the corresponding column totals. OpenIntro notes that both can be thought of as conditional proportions.

The word “given” marks the condition. OpenStax (Introductory Statistics 2e, section 3.4, Contingency Tables) puts it this way: for P(cell phone user | violation) = 25/70, the sample space is reduced to the drivers who had a violation. A conditional relative frequency is the same idea written as a proportion of the table: restrict to one row or one column, then divide by that group’s total. For how the marginal and joint totals are defined, see how to calculate marginal probability and the joint probability formula.

The formula

For a table with rows i and columns j, let nij be the count in a cell, ni· the row total and n·j the column total.

  • Row conditional relative frequency: nij / ni·. Answers “among members of row i, what share are in column j?”
  • Column conditional relative frequency: nij / n·j. Answers “among members of column j, what share are in row i?”

Self-check: in a row conditional table every row sums to 1; in a column conditional table every column sums to 1. After rounding to three decimals (the convention OpenIntro uses in its tables), a total may read 0.999 or 1.001 because of rounding; that is not an error. For the underlying probability version, see how to calculate conditional probability.

Row or column: which table should you build?

OpenIntro advises that it is usually most useful to condition on the explanatory variable. Put the variable you think of as the group or the cause in the rows and build a row conditional table; then each row is directly comparable with the others. Build the column version only when the question is the other way round (“of those who chose R, what share work in the field?”). The two tables use the same counts and give different numbers, so state which one you computed.

Worked example 1: row and column tables from the same counts

The counts below are illustrative, not survey data. They cross a student’s program (rows) with the tool they use most for analysis (columns).

Program Spreadsheet R Python Row total
Lab-based 36 24 20 80
Field-based 24 36 60 120
Column total 60 60 80 200

Row conditional relative frequencies (each count divided by its row total; rounded to three decimals):

Program Spreadsheet R Python Row sum
Lab-based (n = 80) 36/80 = 0.450 24/80 = 0.300 20/80 = 0.250 1.000
Field-based (n = 120) 24/120 = 0.200 36/120 = 0.300 60/120 = 0.500 1.000

Reading: 0.250 is the share of lab-based students who use Python most. Column conditional relative frequencies (each count divided by its column total):

Program Spreadsheet (n = 60) R (n = 60) Python (n = 80)
Lab-based 36/60 = 0.600 24/60 = 0.400 20/80 = 0.250
Field-based 24/60 = 0.400 36/60 = 0.600 60/80 = 0.750
Column sum 1.000 1.000 1.000

Reading: 0.250 appears again in the Python column, but it now means that a quarter of Python users are lab-based. Same cell, same count of 20, different question. Mixing up the two readings is the common error.

Worked example 2: OpenIntro loan data

OpenIntro’s Table 4.1 cross-classifies 10,000 loan applications by application type and homeownership (see Sources):

Application type Rent Mortgage Own Total
Joint 362 950 183 1,495
Individual 3,496 3,839 1,170 8,505
Total 3,858 4,789 1,353 10,000

Row proportions (OpenIntro Table 4.3): for individual applications, 3,496 / 8,505 = 0.411 rent, 3,839 / 8,505 = 0.451 mortgage and 1,170 / 8,505 = 0.138 own. So 0.451 is the share of individual applicants who have a mortgage. For joint applications the row is 0.242, 0.635 and 0.122.

Column proportions (Table 4.4): for mortgage holders, 3,839 / 4,789 = 0.802 applied individually and 950 / 4,789 = 0.198 applied jointly. So 0.802 is the share of mortgage holders who applied individually. The two numbers, 0.451 and 0.802, come from the same cell and answer different questions.

Reading the table: do the groups differ?

Compare the conditional distributions with each other. In example 1 the row distributions differ clearly (Python 0.250 versus 0.500), so program and tool preference look related in these illustrative counts. In OpenIntro’s loan data, the column rates of joint applications differ across rent, mortgage and own (0.094, 0.198 and 0.135), which OpenIntro describes as evidence that application type and homeownership may be associated.

A useful reference point is the overall (marginal) distribution. In example 1, 60 of 200 students (0.300) use R most. Both rows show 0.300 for R, equal to that marginal share, so being lab- or field-based makes no difference to R use here, while the other two columns do differ. This comparison describes the sample; it is not a significance test. For a test, see the chi-square test, and for a strength-of-association measure see Cramér’s V. For a general reading walkthrough, see how to read a contingency table.

How to compute it in Excel, R and Python

Each method is plain division by the right total. Put the counts from example 1 in B2:D3, row totals in E2:E3 and column totals in B4:D4.

Excel

Row conditional:    =B2/$E2     (fill right and down)
Column conditional: =B2/B$4     (fill right and down)
Rounding:           =ROUND(B2/$E2, 3)

If you start from raw records instead of a count table, build the counts first; see crosstabs in Excel.

R

tbl <- matrix(c(36, 24, 24, 36, 20, 60), nrow = 2,
              dimnames = list(Program = c("Lab", "Field"),
                              Tool = c("Spreadsheet", "R", "Python")))
round(prop.table(tbl, 1), 3)   # row conditional: each row sums to 1
round(prop.table(tbl, 2), 3)   # column conditional: each column sums to 1

The second argument of prop.table is the margin: 1 for rows, 2 for columns. See also crosstabs in R.

Python (pandas)

import pandas as pd
counts = pd.DataFrame([[36, 24, 20], [24, 36, 60]],
                      index=["Lab", "Field"],
                      columns=["Spreadsheet", "R", "Python"])
row_cond = counts.div(counts.sum(axis=1), axis=0).round(3)
col_cond = counts.div(counts.sum(axis=0), axis=1).round(3)
# From raw data: pd.crosstab(df["program"], df["tool"], normalize="index")  # or "columns"

Sources and rounding

Example 1 uses illustrative counts created for this page. Example 2 reproduces counts and proportions from OpenIntro, Introduction to Modern Statistics (Tables 4.1, 4.3 and 4.4). All proportions are rounded to three decimals, so rows or columns can sum to 0.999 or 1.001. Sources checked 2026-10-29:

FAQ

What is conditional relative frequency?

It is a cell count divided by the total of its row or its column rather than by the grand total. It tells you the share of one group that falls in a given category, such as the share of individual applicants who have a mortgage (0.451 in OpenIntro’s data). For the single-variable version, see relative frequency and frequency distributions.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Conditional Relative Frequency Table: How to Build One

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.