R script

In today’s business setting, data analysis is becoming increasingly important. Companies are looking for tools that can help them analyze data faster and more efficiently. Power BI is one such tool that can help organizations achieve this goal by allowing them to connect to various data sources.

R script

One of the data sources that Power BI can connect to is R script. R script is a popular programming language used by data scientists for statistical computing. In this article, we will look at how to use Power Query M Language code to connect to R script data sources from inside Power BI.

What is Power Query M Language?

Power Query M Language is a functional programming language used to perform data transformations in Power BI. The language is used to create queries that extract data from different data sources, transform the data, and load it into the data model.

Connecting to R script Data Source

To connect to an R script data source from inside Power BI, you will need to follow these steps:

1. Open Power BI Desktop and select the Home tab.

2. Click on the “Get Data” button and select “More” from the drop-down menu.

3. From the list of available data sources, select “R script” and click on the “Connect” button.

Once you have completed the above steps, you will be presented with the R script Editor window. Here, you can write your R code and connect it to Power BI.

Writing M Language Code to Connect to R script Data Source

To write M Language code to connect to R script data source, follow these steps:

1. In the R script Editor window, click on the “New Source” button.

2. In the “New Source” window, select “Blank Query” and click on the “OK” button.

3. In the Query Editor window, click on the “Advanced Editor” button.

4. In the Advanced Editor window, enter the following code:


let

Source = R.Execute(“source(‘path/to/R/file’)”)[Data]

in

Source


In this code, replace “path/to/R/file” with the actual path to your R script.

Once you have entered the code, click on the “Done” button to close the Advanced Editor window. You will now be taken back to the Query Editor window.

Loading Data into Power BI

To load the data from your R script into Power BI, follow these steps:

1. In the Query Editor window, click on the “Close & Apply” button.

2. Power BI will now load the data from your R script and display it in the “Fields” pane.

You can now use this data in your visualizations, charts, and tables.

Conclusion

In this article, we have looked at how to use Power Query M Language code to connect to R script data sources from inside Power BI. By following the steps outlined above, you can easily connect to your R script and load the data into Power BI for further analysis.

Power BI provides a powerful platform for data analysis, and by connecting it to R script, you can extend its capabilities even further. With the right skills and knowledge, you can use these tools to gain valuable insights into your data and make better business decisions.

Power BI Training Courses by G Com Solutions (0800 998 9248)

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)

    Similar Posts