简体   繁体   中英

Data manipulation in Power BI

I am new to Power BI and have recently been exploring its potential use as a data visualization tool. I currently add my data through Get Data -> "R Script" where I use read.csv and the dplyr package to import and sort through the messy data. I currently haven't found a way to edit the import scripts so any new changes I make to the script result in me having to re-import the data and reconnecting all the app links.

My potential new approach is to import the data into Power BI with read.csv and modifying the contents via Transform Data -> Transform -> R Script. My issue is that when I run the following script Power BI's output is an empty table:

i.e:# 'dataset' holds the input data for this script

library(dplyr)

dataset <- dataset %>%
select(2,3,4) %>%
rename(First= A) %>%
rename(Last= B) %>%
rename(Extra= C)

Said script runs on RStudio, any suggestions?

Your second approach sounds about right which is to load data first in Power BI and then transform it in R.

Load the output of your R script to a new variable which should fix the problem. Updated script is below:

library(dplyr)

output <- dataset %>%
select(2,3,4) %>%
rename(First= A) %>%
rename(Last= B) %>%
rename(Extra= C)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM