Re: [R] Converting scraped data

2010-10-06 Thread Brian Diggs
On 10/6/2010 8:52 AM, Simon Kiss wrote: Dear Colleagues, I used this code to scrape data from the URL conatined within. This code should be reproducible. require("XML") library(XML) theurl <- "http://www.queensu.ca/cora/_trends/mip_2006.htm"; tables <- readHTMLTable(theurl) n.rows <- unlist(lapp

Re: [R] Converting scraped data

2010-10-06 Thread Ethan Brown
Hi Simon, You'll notice the "test" data.frame has a whole mix of characters in the columns you're interested, including a "-" for missing values, and that the columns you're interested in are in fact factors. as.numeric(factor) returns the level of the factor, not the value of the level. (See ?le

[R] Converting scraped data

2010-10-06 Thread Simon Kiss
Dear Colleagues, I used this code to scrape data from the URL conatined within. This code should be reproducible. require("XML") library(XML) theurl <- "http://www.queensu.ca/cora/_trends/mip_2006.htm"; tables <- readHTMLTable(theurl) n.rows <- unlist(lapply(tables, function(t) dim(t)[1])) cl