Monday, December 7, 2015

How do you get data on a Web URL using R Studio?

Read here about R Studio if are not using R Studio. The post shows how to download and install.

Launch R Studio preferably with Administrator Privileges. The UI opens as shown here:


In the main menu click on Tools to get the following:


Click From Web URL.... This is supposed to access data stored on a web server. The program requests the URL address from where you get the data as shown.


Well what kind of data can be accessed as there are many ways to store data?

Well R Studio can access data on a text file or a file with CSV extension on a Web URL.

If you want to test this, create a text file such as the one shown here:
FirstName LastName Age
Tom       Jones    50
Lily      Brown    35
Billy     King     25
Store it as Students.txt (or as Students.csv) and save it to the local web server's (IIS) WWWRoot folder. Of course you need to have permission to save to this folder. By doing this you are placing the file on your local web server.

Now go back to the R Studio and click on the From Web URL... as previously mentioned. Enter as shown here.

There is a small error, it should be Students.txt. The importing takes place as shown in the window that gets displayed.


Click Import and the data gets entered as shown. You can also see the contents of code run in the console as shown in the next image.


No comments: