Plotting bar chart in R (I) - HKBUPhonLab.Ep.44

Опубликовано: 08 Август 2026
на канале: HKBU Phonology Laboratory
39
0

HKBU Phonology Lab
http://arts.hkbu.edu.hk/phonlab/index...

Sample R code:
Import data
data1 = read.csv(file.choose(), header = TRUE, sep=",")
check the first few rows
head(data1)

Count the number of a value in a column
data1group = table(data1$Training)
data1group

barplot(data1group)

barplot(data1group, main="No. of Participants per Group")

barplot(data1group,
main="No. of Participants per Group",
xlab="Group",
ylab="No.")

barplot(data1group,
main="No. of Participants per Group",
xlab="Group",
ylab="No.",
col="blue")

barplot(data1group,
main="No. of Participants per Group",
xlab="Group",
ylab="No.",
col="blue",
horiz = TRUE)

barplot(data1group,
main="No. of Participants per Group",
ylab="Group",
xlab="No.",
col="blue",
horiz = TRUE)

Thanks to the HKBU Faculty of Arts for the support in the video making.
Lab director: Mingxing Li
Technical assistant: Vesper Liu
Director and camera: Kennix Chow
Copy editing: Tsui Ying Ho