Description Usage Arguments Value Author(s) References See Also Examples
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.
1 | processTable(Table, num = NULL, Names = NULL)
|
Table |
A table of character entries, usually an item from the list of tables returned by |
num |
Column numbers for the numerical columns. |
Names |
Column names to add to the final data frame. |
A data frame.
David M Diez
OpenIntro (http://www.openintro.org/)
1 2 3 4 5 6 7 8 9 10 11 12 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.