Read data from the Internet

I have a remote folder on a web server containing data. I access the data with:

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

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

thank.

+3
source share
2 answers

You can use the RCurl package :

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

Generally speaking, you can embed usernames and passwords in a URL, for example:

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

+3
source

Source: https://habr.com/ru/post/1754390/


All Articles