【问题标题】:R in Power BI: Error in plot.window(...) : need finite 'xlim' valuesPower BI 中的 R:plot.window(...) 中的错误:需要有限的“xlim”值
【发布时间】:2017-08-14 17:24:26
【问题描述】:

在 Power BI 中使用 R 可视化

错误:

Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: R script error.
Error in plot.window(...) : need finite 'xlim' values
Calls: plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
Execution halted
 ---> Microsoft.PowerBI.Radio.RScriptRuntimeException: R script error.
Error in plot.window(...) : need finite 'xlim' values
Calls: plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
Execution halted

只有在我尝试对数据进行子集化时才会收到上述错误。

通过阅读其他类似问题,我检查了我的数据类型,它们分别是 Integer 和 Double。

我还使用 any(is.na(dataset)) 检查了数据中的 NA 值,结果显示没有 NA 值。

当我输入 xlimylim 值时,我的绘图变为空白。

代码:

dataset <- dataset[dataset$Column1=="T1",] #Subset of data I want. All rows where Column1 is equal to T1.

x <- as.numeric(dataset$`Height`) # Integer
y <- as.numeric(dataset$`Pct Pop`)  # Double
plot(x, y,
xlim = c(0, 45000),
ylim = c(0, 1.5)
)

【问题讨论】:

    标签: r powerbi


    【解决方案1】:

    我通过使用 power bi 过滤方法添加我想要的过滤器来修复此错误,而不是像您通常在 R 中那样尝试创建我的数据子集。要完成此操作,请单击您的图表并在右下角将看到一个名为“过滤器”的部分,您可以在其中添加列和约束。

    【讨论】:

    • 这很有魅力!看来我们不必使用 Rscript 执行过滤。而是使用 Power Bi 过滤器来过滤并最终导入数据。
    猜你喜欢
    • 1970-01-01
    • 2014-02-16
    • 1970-01-01
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多