14. Link R Studio to Power BI and how to use R code in Power BI

Опубликовано: 13 Март 2026
на канале: Learn data analytics with us
2,133
16

hello guys my name is khan and in today's video we will discuss that how you can link r or r studio to power bi uh and we will discuss that what's the u why is it important or how useful it is to link r to power bi so one of the reason of linking r to power bi is that you can easily import data into power bi you can easily import multiple data frames or data sets into power bi with the help of r and the second thing will be that it will be if so suppose if you are good in r then you don't need to learn data manipulation in power via you can first manipulate the data with an r and then you can link r to power va and then you can use your manipulated data in there in terms of it by so by data manipulation i mean that you can merge data set in r or you can create new variables in r or you can do a whatever machine learning analysis in r and then after applying those analysis in your data set then you can import those data frames over which you have done some analysis or have created new variable or data point then you can import those data session data frames into power bi very easily into power in power bi so what i will do i will first quickly show how you can do that so again i will go to my search i will look for power here so this is the app we are using

so while it's lo so there my laptop is loading power bi desktop so meanwhile i will also so this is the script file that i will be using for power bi so if you guys are not familiar with r then i think this video is mainly about for those of you users which viewers for the audience that have some experience it are but even if you don't know are much so don't worry i will try to cover things that make you feel comfortable so this is the script file script file in the r is like a code file where you write down your command so i will open this file for you guys but meanwhile i will also show you one more thing in that folder so this is the folder i am using for this video which is link r to power bi uh actually in the code file which is in the uh which i have used in the r i will be importing these data sets csv dataset excel that is said rds data stata data so these are different data formats or data types that i have so in r it becomes a bit easier because r also allows you uh to import data set into into r which are maybe not spot by the power bay even then you can use r2 so my power bi is there so but i will go to my core files this is the script file i will maximize into a separate window so i will quickly go to introduction so whatever you will do in your code file which is this file as you can see uh it will appear here or what all the results will show you in the console and all the data frames that we will create through this code will appear in our global environment and then there are other tabs which are not much related to this video and if you guys want to know more about r there is also a video set that i have made related to r so you can also search for those videos too so what i will do the first thing is that my first data set that i am using so i have defined the working directory working directly means that where my data is located so my data is located in this folder so the first data set i am using is in a csv format and as you can see i also named the csv underscore data so in order to import that data set i am using this read.csv function so this function is kind is is calling this dataset from the given folder and then after importing that dataset which was in csv format i assign that uh data to a data object named as also csv underscore data so let's see if i execute this code till line number 10 control shift home and then control enter now.

#rstudio #powerbi #rcode