Showing posts with label RODBC. Show all posts
Showing posts with label RODBC. Show all posts

Sunday, August 14, 2016

What is R Interactive and how do you load it?

R GUI is an interactive window from R Foundation.


When you install Visual Studio 2015 Community Update 3 or install Microsoft R Client you can bring up R Interactive within Visual Studio IDE. This is really very nice and you have the full access to intellisense that makes it very easy to use the interface. You would really appreciate if you had the experience of using the Open Source R.

Here are some screen shots of its usage in Visual Studio 2015 Community Update 3. You launch R Interactive from R Tools menu in Visual Studio 2015 Community Update 3.


This brings up the message that you have logged into your Microsoft Account.


If you are logged in you get to display the R Interactive pane as shown.
 



This looks similar to the one from Open Source, but wait. You can load the library RODBC straight away and you get the functions that you can use, thanks to intellisense.


Now I try to establish an ODBC connection to my SQL Server 2016, voila, again intellisense to the rescue. In Open Source you have to look up some documents to get these.


OK, I have a User DSN to my SQL Server 2016 called 'HSQL' and I try to call.

Well, I have the full details of my User DSN.

This is the way to go if you are interested in productivity.

More in my future posts on this blog and the other:
http://hodentekMSSS.blogspot.com

Read the posts related to this post here:


http://hodentekhelp.blogspot.com/2016/08/what-is-needed-to-leverage-r-from.html

http://hodentekhelp.blogspot.com/2016/07/how-are-user-dsn-system-dsn-and-file.html

http://hodentekmsss.blogspot.com/2016/08/viewing-tables-on-sql-server-2016.html

http://hodentekmsss.blogspot.com/2016/07/you-need-this-to-connect-to-sql-server.html

Tuesday, October 6, 2015

How do you access data using ODBC data connectivity in R?

R language is well suited for statistics and graphics. R is also good at handling data, perhaps not in large-scale. In order to connect to an ODBC source, it needs an ODBC connector which is found in a library called RODBC.

When you install a number of packages are available out of the box shown here:
 

Installed Packages.png

However you may not find the RODBC in the list. You need to install this library.
You can find RODBC library download here for WIndows.
https://cran.r-project.org/web/packages/RODBC/index.html

You will be downloading a zip file named RODBC_1.3-12.zip

You can download it to a location of your choice but move this file to the( library folder) in the folder created by the R installation.
 

The zip file from the download location(desktop) was moved to the folder C:\Program Files\R\R-3.2.2\library.

librarywithRODBC

 

 
Now if you bring up the installed packages from R-GUI you will see RODBC as shown.

LoadPackages2

Now you are ready to use the RODBC library in working with R.
In the RGUI(64-bit) just type library (RODBC) at the prompt as shown. You get another prompt but nothing else.
--------
> library(RODBC)
>
---------
For help with RODBC you can type the following at R prompt:
----------
>help(package=RODBC)
---------
This will open up the help file in HTML at : http://127.0.0.1:27629/library/RODBC/html/00Index.html as shown:


RODBCDoc.png

Now you can use this help file to explore RODBC further.

There are two groups of functions in RODBC, The internet odbc* commands implement low-level access to ODBC functions and the sql* functions operate at a higher level to read, save, copy etc. You can connect to hosts or DSNs.

Happy data hunting!