plot.intsvy.table: Graphical representation of frequency tables

View source: R/plot.intsvy.table.R

plot.intsvy.tableR Documentation

Graphical representation of frequency tables

Description

Functions pisa.table and piaac.table produce object of the class intsvy.table. The function plot.intsvy.table presents this table graphically.

Usage

## S3 method for class 'intsvy.table'
plot(x, se=FALSE, stacked=FALSE, centered = FALSE, midpoint = NA, ...)

Arguments

x

An object of the class intsvy.table returned by pisa.table or piaac.table functions.

se

If TRUE add whiskers for standard errors (only for stacked=FALSE).

stacked

If TRUE plot bars stacked one over another.

centered

If TRUE then bars will be centered around midpoint.

midpoint

A single number, which specifies the segment around which bars are centered. By default it's the middle segment calculated as (n.levels + 1)/2. If n.levels is odd then bars are centered around the beginning of the selected segment. If n.levels is even then bars are centered around the middle of the selected segment.

...

Not used. Required for cran-check.

Value

Returns object of ggplot class with barplot. Works for one way, two-way and three-way contingency tables.

See Also

plot.intsvy.mean, plot.intsvy.reg

Examples

## Not run: 
# install pbiecek/PIAAC package from github to have access to piaac data
# age distribution in whole dataset
(ptable <- piaac.table(variable="AGEG10LFS", data=piaac))

# age distribution in whole dataset
plot(ptable)
plot(ptable, centered=TRUE)

# age distribution within countries
head(ptableC <- piaac.table(variable="AGEG10LFS", by="CNTRYID", data=piaac))

# age distribution within countries
plot(ptableC, stacked=TRUE)
plot(na.omit(ptableC), centered=TRUE)

# age distribution within countries and gender segments
head(ptableCA <- piaac.table(variable="AGEG10LFS", by=c("CNTRYID", "GENDER_R"), data=piaac))

# age distribution within countries and gender segments
plot(na.omit(ptableCA), stacked=TRUE)
plot(na.omit(ptableCA), centered=TRUE)


## End(Not run)

intsvy documentation built on Oct. 3, 2023, 1:07 a.m.