【问题标题】:Is there a way to create an R matrix (datatype) in PowerBI?有没有办法在 Power BI 中创建 R 矩阵(数据类型)?
【发布时间】:2020-06-15 12:14:44
【问题描述】:

我试图使用 R 脚本(矩阵数据类型)在 PowerBI 中创建一个表。

dt <- matrix(c(12,2,7,9), 2, 2)

dimnames(dt) <- list(Diarrhea = c("Yes", "No"),
                       "Antibody level" = c("Low", "High")
)

很遗憾,PowerBI 无法识别矩阵数据类型来加载表格。

高度赞赏任何实现此目的的解决方法。

【问题讨论】:

    标签: r powerbi


    【解决方案1】:

    您可以将矩阵保存为 Power BI 可以读取的序列化格式:


    csv

    write.csv(dt, "powerbi.csv")
    

    json

    writeLines(jsonlite::toJSON(dt), "powerbi.json")
    

    writeLines(jsonlite::serializeJSON(dt), "powerbi.json")
    

    【讨论】:

    • 当我将它导入回 PowerBI 时,行名被解释为一个新列。这对我的用例没有帮助。
    猜你喜欢
    • 1970-01-01
    • 2019-11-12
    • 1970-01-01
    • 2021-08-20
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多