Practical guides ↗

R · Visualization

Create a bar chart from frequencies

Work with the mini survey and compare your output with the expected result.

4 min readScope: R / base R

Mini exercises · Practice with data ↓

Try it in three steps

  1. Extract the mini exercise package below. Complete the cleaning task or use anket-temiz.csv. No extra R package is required.
  2. Work in the data folder and load the data: df <- read.csv("anket-temiz.csv", na.strings="")
  3. Run: barplot(table(factor(df$transport, levels=c("bus", "walk", "bike"))), ylim=c(0,12), ylab="Participants", main="Synthetic survey (n=20)")

How to read the output

bus=10, walk=6, bike=4. The vertical axis counts participants; percentages are 50%, 30%, 20%.

Test your understanding.

True or false?

These synthetic data establish conclusions about a real population.

Related concepts

Official source

R · Documentation ↗

Documentation checked: . Steps are based on official documentation and have not been tested in the application. Menu names may differ by version and interface language.