PowerBi中的RScript网络映射

PowerBi中的RScript网络映射,r,powerbi,rscript,R,Powerbi,Rscript,我是PowerBI新手,正在尝试在PowerBI中显示我的R网络图 我的脚本使用以下代码在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')

我是PowerBI新手,正在尝试在PowerBI中显示我的R网络图

我的脚本使用以下代码在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)
}
install.packages(“maps”),repos='1http://cran.us.r-project.org')
安装.packages(“geosphere”,repos=)http://cran.us.r-project.org')
install.packages(“readxl”,repos=)http://cran.us.r-project.org')
图书馆(“地图”)
图书馆(“地球圈”)
图书馆(“readxl”)

机场您可以在这里获得更多信息