[R] Need help with text processing / string split
eric
ericstrom at aol.com
Sun May 15 21:50:26 CEST 2011
I used screen scraping to extract some information and put it into a table
called tbl. Now I want to modify the table a bit so the data can be more
useful. Here's the code I used:
library(XML)
rm(list=ls())
url <-
"http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011"
tbl <-data.frame(readHTMLTable(url))[2:405, c(3,5,6,8,9)]
names(tbl) <- c("Address", "Township", "Parcel", "Sale Date", "Costs")
tbl is attached as txt for your convenience. Entries in the last column of
the dataframe (tbl$Cost) appear as follows: $173,933.60$2,410.28 .
http://r.789695.n4.nabble.com/file/n3524793/tbl.txt tbl.txt
How do I:
1. Split the string
2. Have the two values show up as actual numbers that can be used
3. Put the numbers in two separate columns of the dataframe.
In other words $173,933.60$2,410.28 would show up as 173933.60 in one column
and 2410.28 would show up in a second column of tbl
I tried using strsplit but I could not get it working properly.
--
View this message in context: http://r.789695.n4.nabble.com/Need-help-with-text-processing-string-split-tp3524793p3524793.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list