2011-05-10 75 views
4

我試圖從URLauth閱讀R一個CSV讀R A CSV,我有密碼和一切我只需要知道如何添加到命令,順便說一句我的密碼不包括@焦炭所以它搞砸了我的方案[1]如何從HTTP與AUTH

這是我想要的命令:

products <- read.csv("http://username:[email protected]@domain.com/api/products_by_date.csv?start_date=2011-04-01&end_date=2011-04-01", head=TRUE) 

我的輸出是:

Error in file(file, "rt") : cannot open the connection 
In addition: Warning message: 
In file(file, "rt") : unable to resolve 'username' 

[1] scheme://username:[email protected]:port/path?query_string#fragment_id 

回答

5

您可以在RCurl包中嘗試getURL包,該包具有對HTTP請求進行身份驗證的功能。例如參見?getURL