This provides an simple function to read in tables from Table Builder without having to 'tidy' the tables first. The basic idea is that the function looks for the first row that has its cell value equal to 'Count' which is what appeared in all Table Builder tables. The 'Count' cell usually appear in as the last column on the table and never the first.

abs_read_tb(x, .names = c("asis", "simplify", "clean"), exclude_total = TRUE)

Arguments

x

path to a csv file exported from ABS Table Builder.

.names

Default as 'asis' returns names as is. "simplify" use only the abbreviations in small caps. While "clean" uses janitor::clean_names().

exclude_total

exclude rows with Total

Value

a data.table

Examples

data_dir <- system.file("extdata", package = "abs") test_csv <- file.path(data_dir, "tb1.csv") mytable <- abs_read_tb(test_csv)
#> Warning: Stopped early on line 20. Expected 3 fields but found 0. Consider fill=TRUE and comment.char=. First discarded non-empty line: <<"Data Source: Census of Population and Housing, 2011, TableBuilder">>