【发布时间】: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 值。
当我输入 xlim 和 ylim 值时,我的绘图变为空白。
代码:
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)
)
【问题讨论】: