R: Process selected columns of a table into numbers
processTable
R Documentation
Process selected columns of a table into numbers
Description
Given a table where some columns represent numeric values but are cluttered with info like dollar signs, percent signs, among other symbols, this function cleans up those columns and converts the entire table into a data frame.
Usage
processTable(Table, num = NULL, Names = NULL)
Arguments
Table
A table of character entries, usually an item from the list of tables returned by getTables.
## Not run:
URL <- "http://en.wikipedia.org/wiki/Poverty_in_the_United_States"
Tables <- getTables(URL)
thisOne <- which(sapply(Tables, "[", 1, 1) == "Persons in Family Unit")
if(length(thisOne) > 0){
temp <- Tables[[thisOne[1]]]
processTable(temp[-c(1),], 1:4)
}
# warning may be produced for one entry
# "each additional person adds"
## End(Not run)