URL problems in R

I am new to R and am having trouble retrieving data from the Forbes site.

My current function:

url =

 http://www.forbes.com/global2000/list/#page:1_sortmail_direction:asc_search:_filter:All%20industries_filter:All%20countries_filter:All%20states

data = readHTMLTable (url)

However, when I change page # in the URL from 1 to 2 (or to any other number), the data that is being pulled out is the same data from page 1. For some reason, R is not pulling the data from the correct page. If you manually insert the link into the browser with a specific page #, then it works fine.

Does anyone have an idea why this is happening?

Thank!

+4
source share
2 answers

, -, , URL, . .

, readHTMLTable() URL-. , , # URL.

, , : , "" "

https://support.microsoft.com/kb/202261/en-us

- , .

+1

, URLencode() R.

kdb.url <- "http://m1:5000/q.csv?select from data0 where folio0 = `KF"
kdb.url <- URLencode(kdb.url)
df <- read.csv(kdb.url, header=TRUE)

, . (Mine - .)

>kdb.url
[1] "http://m1:5000/q.csv?select%20from%20data0%20where%20folio0%20=%20%60KF"

R.

0

All Articles