Connect R to the BoviSync Performance Data Link in Windows

Connect R to the BoviSync Performance Data Link in Windows

What is the R-Project?

R is a free, open-source programming language and software environment designed specifically for statistical computing and graphics. It was created by statisticians and is widely used by data analysts, data scientists, and researchers for data analysis, data visualization, and statistical modeling. https://www.r-project.org/about.html

Instructions and R script provided are for the purposes of getting started with R and the BoviSync Performance Data Link in Snowflake.
Warning
These instructions, the script, and data queried are provide as-is.

Prerequisites

  1. BoviSync Team
  2. Snowflake Account
  3. Permission Grant to teams from farms
  4. R studio

Here are the steps to install and setup R on Windows:

  1. Download R:
    1. Go to the CRAN website.
    2. Click on the link to “Download R for Windows.”
  2. Run the Installer:
  3. Once the download is complete, run the .exe file.
    1. Follow the installation instructions. You can usually just click “Next” through the default settings.
  4. Launch R:
  5. After the installation is complete, you can launch R from the Start menu or by searching for it in your applications
  6. Install ODBC and connect to the BoviSync Performance Data Link - Installing and configuring the ODBC Driver for Windows | Snowflake Documentation
  7. Access ODBC from R console. Success will result in current version result. 
    1. myconn <- odbcConnect("YourODBCConnection", uid="YourSnowflakeUser", pwd="")

      mydata <- sqlQuery(myconn, "YourSnowflakeWarehouse")

      mydata <- sqlQuery (myconn, "select current_version()")

      mydata

  8. A sample R script is attached for connecting to a table in the BoviSync Performance Data Link. 



Scripts and samples 

DopnXfarm.r 
Test your connection in R by running a small script with a function to generate scatterplots for farms in your Snowflake account from the BoviSync Performance Data Link

Instructions:
  1. edit the connection information in the script to match the ODBC listing for your Snowflake Account and database. 
  2. run the script once connected. File will create and save scatterplots with regression lines for each herd accessible in your team link.