How To use R Integration in Power BI

0 votes
I am trying to use R scripts in Power BI. I have installed the latest version of R from cran repository and have R Studio as well.

The problem is how do I extract my data and what all packages are there in R?
May 2, 2019 in Power BI by Phalguni
• 1,020 points

1 answer to this question.

0 votes


There are a lot of packages available in R. However if you are not able to use R, make sure you enable its visualizations from the options menu. 

You can now load your data with the help of R SCRIPTS into Power BI. To enable option for "Run R Scripts" you need to go to queries editor and transform your data into usable format first. 

The list of some of the packages available in R as follows:

To load data

DBI - The standard for for communication between R and relational database management systems. Packages that connect R to databases depend on the DBI package.

odbc - Use any ODBC driver with the odbc package to connect R to your database. Note: RStudio professional products come with professional drivers for some of the most popular databases.

RMySQL, RPostgresSQL, RSQLite - If you'd like to read in data from a database, these packages are a good place to start. Choose the package that fits your type of database.

XLConnect, xlsx - These packages help you read and write Micorsoft Excel files from R. You can also just export your spreadsheets from Excel as .csv's.

foreign - Want to read a SAS data set into R? Or an SPSS data set? Foreign provides functions that help you load data files from other programs into R.

haven - Enables R to read and write data from SAS, SPSS, and Stata.

To manipulate data

dplyr - Essential shortcuts for subsetting, summarizing, rearranging, and joining together data sets. dplyr is our go to package for fast data manipulation.

tidyr - Tools for changing the layout of your data sets. Use the gather and spread functions to convert your data into the tidy format, the layout R likes best.

stringr - Easy to learn tools for regular expressions and character strings.

lubridate - Tools that make working with dates and times easier.

To visualize data

ggplot2 - R's famous package for making beautiful graphics. ggplot2 lets you use the grammar of graphics to build layered, customizable plots.

ggvis - Interactive, web based graphics built with the grammar of graphics.

rgl - Interactive 3D visualizations with R

htmlwidgets - A fast way to build interactive (javascript based) visualizations with R. Packages that implement htmlwidgets include:

  • leaflet (maps)
  • dygraphs (time series)
  • DT (tables)
  • diagrammeR (diagrams)
  • network3D (network graphs)
  • threeJS (3D scatterplots and globes).

To model data

car - car's Anova function is popular for making type II and type III Anova tables.

mgcv - Generalized Additive Models

lme4/nlme - Linear and Non-linear mixed effects models

randomForest - Random forest methods from machine learning

multcomp - Tools for multiple comparison testing

vcd - Visualization tools and tests for categorical data

glmnet - Lasso and elastic-net regression methods with cross validation

survival - Tools for survival analysis

caret - Tools for training regression and classification models

To report results

shiny - Easily make interactive, web apps with R. A perfect way to explore data and share findings with non-programmers.

R Markdown - The perfect workflow for reproducible reporting.

xtable - The xtable function takes an R object (like a data frame) and returns the latex or HTML code you need to paste a pretty version of the object into your documents. Copy and paste, or pair up with R Markdown.

For Spatial data

sp, maptools - Tools for loading and using spatial data including shapefiles.

maps - Easy to use map polygons for plots.

ggmap - Download street maps straight from Google maps and use them as a background in your ggplots.

For Time Series and Financial data

zoo - Provides the most popular format for saving time series objects in R.

xts - Very flexible tools for manipulating time series data sets.

quantmod - Tools for downloading financial data, plotting common charts, and doing technical analysis.

To write high performance R code

Rcpp - Write R functions that call C++ code for lightning fast speed.

data.table - An alternative way to organize data sets for very, very fast operations. Useful for big data.

parallel - Use parallel processing in R to speed up your code or to crunch large data sets.

To work with the web

XML - Read and create XML documents with R

jsonlite - Read and create JSON data tables with R

httr - A set of useful tools for working with http connections

To write your own R packages

devtools - An essential suite of tools for turning your code into an R package.

testthat - testthat provides an easy way to write unit tests for your code projects.

roxygen2 - A quick way to document your R packages. roxygen2 turns inline code comments into documentation pages and builds a package namespace.

Ready to revolutionize your data skills? Explore our dynamic Power BI Course Syllabus designed to empower you with in-depth knowledge and practical expertise.

answered May 3, 2019 by Avantika
• 1,520 points

Related Questions In Power BI

0 votes
1 answer

How to use a gateway in Power Bi?

Follow the below procedure - 1. Install ...READ MORE

answered Oct 29, 2019 in Power BI by rachael
0 votes
1 answer

How to Create and use doughnut charts in Power BI?

Hey, To create a doughnut chart in Power ...READ MORE

answered Feb 6, 2020 in Power BI by Gitika
• 65,910 points
0 votes
1 answer

Is it possible to use R Plotly library in R Script Visual of Power BI?

For newer versions of PowerBI, it's also ...READ MORE

answered Dec 8, 2020 in Power BI by Gitika
• 65,910 points
0 votes
1 answer

How to use Dynamic DAX Number Format in power BI?

You can give them the same display ...READ MORE

answered Dec 8, 2020 in Power BI by Gitika
• 65,910 points
0 votes
0 answers

How do you change the tables in chart filters?

I am working on a report that shows ...READ MORE

May 10, 2019 in Power BI by anonymous
0 votes
1 answer

How do you change the tables in chart filters?

Hi, You can use the following measure. Measure 2 = ...READ MORE

answered May 10, 2019 in Power BI by Avantika
• 1,520 points
0 votes
1 answer

How do I create a line chart?

Hi, From the data mentioned above, you can ...READ MORE

answered May 10, 2019 in Power BI by Avantika
• 1,520 points
0 votes
1 answer

Power BI integration with R

Follow the below steps: 1. Install R in your ...READ MORE

answered Jun 21, 2019 in Power BI by Cherukuri
• 33,030 points
0 votes
1 answer

How do you use R visuals in Power BI Desktop?

Hi, In order to use R Visuals you ...READ MORE

answered Apr 10, 2019 in Power BI by Avantika
• 1,520 points
0 votes
1 answer

How do I use Python scripts in Power BI?

Hi, You can create interactive reports out of ...READ MORE

answered May 2, 2019 in Power BI by Avantika
• 1,520 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP