Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
wcvinyard_gv
New Member

Power BI on Win 11 ARM VM - R Script Error

Hi,

 

Attempting to display R visual using non R-base libraries grid and gridExtra.  

 

The error message produced is listed next, followed by:

(1) a description of my computing environment

(2) Installed versions for Power BI and R

(3) List of R Script that produces error

(4) List of R Script that successfully displays

 

Anyone have any ideas about what may be causing the error?  I do not believe the cause is an incorrect R installation as other stackoverflow forums suggest.

 

Error Message:
A problem occurred while processing your R script.
Here are the technical details:
Running the R script encountered the following error:

Failed to retrieve error code string from System ->317
Double-check that R is installed correctly on your machine.

 

R is correctly installed as I am also able to successfully display visuals that only require R-base libraries.

 

Computing Environment:

 

Host machine:

macbook pro late 2021 Apple Silicon M1 Max

macOS Ventura 13.4.1

 

Parallels VM:

Processor Apple Silicon 3.20 GHz (4 processors)
Installed RAM 32.0 GB
System type 64-bit operating system, ARM-based processor

Edition Windows 11 Pro
Version 21H2
Installed on ‎06/‎09/‎2022
OS build 22000.2057
Experience Windows Feature Experience Pack 1000.22001.1000.0

 

Power BI Desktop -- Version: 2.118.828.0 64-bit (June 2023)

R-4.3.1 (64bit)

 

Error occurs when I attempt to use gridExtra to display a table of data.

.libPaths() 

[1] "C:/rPackages/4.3"
[2] "C:/Program Files (x86)/R/R-4.3.1/library"

 

R-4.3.1 is installed at folllowing location:

C:\Program Files (x86)\R\R-4.3.1

Power BI Options & Settings lists the R Home Path

Above path suggests 32bit install, but it is actually a 64bit install.  This is the way R installs in this Win11 ARM VM environment, as proof, here is the startup message from Rgui:

 

R version 4.3.1 (2023-06-16 ucrt) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

 

Both of below scripts successfully execute and produce visuals in RStudio.

gridExtra_visual.png

 

The script that produces the error is:

**** Code Snip  Start ****

 

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset <- data.frame(Vax Name, VID unt, Total Symp Cnt, Distinct Symp Cnt, Death, Disabled, Life Threat, Avg Nbr Days, Birth Defect, Req ER, Req Hosp)
# dataset <- unique(dataset)

# Paste or type your script code here:
library('grid', lib.loc='C:/rPackages/4.3')
library('gridExtra', lib.loc='C:/rPackages/4.3')

dat <- dataset
dat[is.na(dat)] <- 0

set.seed(123456)

dat_pc <- princomp(dat[, -1], cor=T, fix_sign=TRUE )
dat_km <- kmeans(dat_pc$scores[,1:2], cen = 5)

dat$Comp1 <- dat_pc$sco[,1]
dat$Comp2 <- dat_pc$sco[,2]
dat$Clus  <- dat_km$cluster
dat2 <- dat[,-1]
rownames(dat2) <- dat[, 1]
dat <- dat2
dat <- format(round(dat, 2), nsmall=0, big.mark=",")

colnames(dat) <- sapply(colnames(dat), function(x) paste(strwrap(x, width = 8),  collapse="\n"))
tt <- ttheme_default(
        base_size = 8,
        core     = list(fg_params=list(hjust=1, x=0.90))
      )
grid.arrange(
  tableGrob(head(dat[order(dat$Comp1, decreasing=FALSE),], 20), theme=tt),
  nrow=1
)
 **** Code Snip End ****
 
The script that successfully displays a visual is:
 
**** Code Snip Start ****
 
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset <- data.frame(Vax Name, VID Cnt, Total Symp Cnt, Distinct Symp Cnt, Death, Disabled, Life Threat, Avg Nbr Days, Birth Defect, Req ER, Req Hosp)
# dataset <- unique(dataset)

# Paste or type your script code here:
dat <- dataset
dat[is.na(dat)] <- 0

set.seed(123456)

dat_pc <- princomp(dat[, -1], cor=T, fix_sign=TRUE)
dat_km <- kmeans(dat_pc$scores[,1:2], cen = 5)

par(mfrow=c(2,2))
barplot(dat_pc$sdev, las=2, cex.axis=0.9, cex.names=0.7,main = 'Variance Explained Per Comp')
barplot(dat_pc$loadings[,1], las=2, cex.axis=0.9, cex.names=0.7, main = 'Weight of Orig Vars on Comp 1')
barplot(dat_pc$loadings[,2], las=2, cex.axis=0.9, cex.names=0.7, main = 'Weight of Orig Vars on Comp 2')
plot(dat_pc$scores[,1:2], col = dat_km$clus, cex = 0.5, cex.axis=0.9, cex.lab=0.9, main = 'Kmeans Clusters of Comp1 & 2')
 
**** Code Snip End ****
0 REPLIES 0

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.