[R] parsing Google search results

Philip Leifeld Leifeld at coll.mpg.de
Mon Nov 16 20:29:40 CET 2009


Hi,

how can I parse Google search results? The following code returns 
"integer(0)" instead of "1" although the results of the query clearly 
contain the regex "cran".

####
address <- url("http://www.google.com/search?q=cran")
open(address)
lines <- readLines(address)
grep("cran", lines[3])
####

Thanks

Philip

-- 
Philip Leifeld
Max Planck Institute for     | +49 (0) 1577 6830349 (mobile)
Research on Collective Goods | +49 (0) 228 91416-73 (phone)
MaxNetAging Doctoral Fellow  | +49 (0) 228 91416-62 (fax)
Kurt-Schumacher-Str. 10      |
53113 Bonn, Germany          | http://www.philipleifeld.de




More information about the R-help mailing list