如何在自定义 R 视觉对象中定义来自 Power BI 的数据集



我正在尝试基于 R 脚本在 Power BI 中创建自定义视觉对象,就像在 ( http://radacad.com/interactive-map-using-r-and-power-bi-create-custom-visual-part-1 中发现的示例一样,已成功安装 node.js,pbiviz 中。在 Power BI Desktop 中获取此自定义视觉对象后,我会看到来自示例鸢尾花数据集的所有静态数据,但我希望它使用来自 Power BI 的数据集。如何编辑脚本(如下所示(以允许 Power BI 使用我自己的数据而不是库中的数据?

source('./r_files/flatten_HTML.r')
############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################
################### Actual code ####################
g = qplot(`Petal.Length`, data = iris, fill = `Species`, main = Sys.time());
####################################################
############# Create and save widget ###############
p = ggplotly(g);
internalSaveWidget(p, 'out.html');
####################################################

当我尝试将"虹膜"更改为数据集时,它找不到数据集。我也尝试添加数据集<- data.frame(MyColumns(,但这没有帮助。

如果我的表名为暗淡 - 产品,事实 - 销售和列作为产品名称和总销售额。我该如何定义?

任何具有示例的教程/视频都会真正有所帮助。

使用 cbind 创建包含从 PBI 发送的对象的数据帧。假设您要发送的所有对象都是必需的:

数据集<- as.data.frame(cbind(var1,var2,...((

最新更新