我是PowerBi的新手,并且正在尝试将我的R网络图显示在PowerBi中。
我的脚本使用以下代码在R中按需工作:
install.packages("maps", repos='http://cran.us.r-project.org')
install.packages("geosphere", repos='http://cran.us.r-project.org')
install.packages("readxl", repos='http://cran.us.r-project.org')
library("maps")
library("geosphere")
library("readxl")
airports <- read_excel("C:/Users/jeffrey.tackes/Desktop/BASEMAPPING.xlsx",
sheet="ASI Solo")
flights <- read_excel("C:/Users/jeffrey.tackes/Desktop/BASEMAPPING.xlsx",
sheet="edges")
map("world", col="skyblue", border="gray10", fill=TRUE, bg="black")
points(x=airports$long, y=airports$lat, pch=19,
cex=1, col="orange")
# Generate edge colors
col.1 <- adjustcolor("orange red", alpha=0.4)
col.2 <- adjustcolor("orange", alpha=0.4)
edge.pal <- colorRampPalette(c(col.1, col.2), alpha = TRUE)
edge.col <- edge.pal(100)
# For each path, we will generate the coordinates of an arc that connects
# its star and end point, using gcIntermediate() from package 'geosphere'.
# Then we will plot that arc over the map using lines().
for(i in 1:nrow(flights)) {
node1 <- airports[airports$ID == flights[i,]$from,]
node2 <- airports[airports$ID == flights[i,]$to,]
arc <- gcIntermediate( c(node1[1,]$long, node1[1,]$lat),
c(node2[1,]$long, node2[1,]$lat),
n=1000, addStartEnd=TRUE )
edge.ind <- round(100)
lines(arc, col=edge.col[edge.ind], lwd=edge.ind/30)
}
我的问题是如何将其显示在Powerbi中?当我导入rscript时,它显示了我的4个表,2个带有原始数据源的表,以及在脚本(node1&amp; node2(中创建的2个数据帧
如果我在Powerbi中使用R视觉效果,那我就迷路了。
我尝试从我的R代码中添加我的2个原始表,添加所有字段,然后将我的R代码复制到PowerBi中的R编辑器,但这不起作用。
有帮助吗?
您可以在此处获得更多信息,
https://powerbi.microsoft.com/en-us/guided-learning/powerbi-learning-3-11h-r-visual-integration/