简体   繁体   中英

read data from internet

I have a remote folder on a webserver containing data. I access the data using:

myData <-read.table("http://.../myData.csv", sep=',', header=T)

Is there a way to password protect the remote folder and enter the authorisation in the above command?

Thx.

You could use the RCurl package:

require("RCurl")
read.table(textConnection(getURL("http://.../data.csv",
                                 userpwd = "user:pass")),
           sep=",", header=TRUE)

Generally speaking, you can embed usernames and passwords in the URL, like so:

http://username:pass@myserver.org/path/to/file.dat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM