Re: [R] parsing Google search results

2009-11-17 Thread Tony B
Hi Philip, If i understood correctly, you just wish to get the urls from a given google search? I have some old code you could adapt which extracts the main links from a google search. It makes use of XPath expressions using the lovely XML and RCurl packages: > library(XML) > library(RCurl) > > g

Re: [R] parsing Google search results

2009-11-17 Thread Barry Rowlingson
On Mon, Nov 16, 2009 at 7:29 PM, Philip Leifeld wrote: > 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";) >

[R] parsing Google search results

2009-11-16 Thread Philip Leifeld
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]) ##