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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Alexei
Regular Visitor

R script error on a base function

I use a very simple code to bring the surface plot to Power BI:

library(tidyr)
z <- spread(data=dataset[,c("C3", "TPR", "SalesMargin")], key="TPR", value="SalesMargin")
z <- as.matrix(z[,-1] )

persp( z=z )

 

persp() function works well in R. Actually, the only parameter required is the matrix of values, while x and y are automatically calculated in the function call.

Despite any attempts (adding x and y in various variants, and without them as in the example), function call returns the error when executed in Power BI (see details below). Any thoughts? What's wrong in function? I even was unable to find this error message in a source code of base R on my PC.

 

Feedback Type:
Frown (Error)

Timestamp:
2018-12-06T08:57:44.3308789Z

Local Time:
2018-12-06T09:57:44.3308789+01:00

Session ID:
ac2b720a-ae95-4cca-a8f2-17aab6092ddc

Release:
November 2018

Product Version:
2.64.5285.741 (18.11) (x64)

Error Message:
R script error.
Error in persp.default(z = z) : invalid 'x' argument
Calls: persp -> persp.default
Execution halted


OS Version:
Microsoft Windows NT 10.0.16299.0 (x64 en-US)

CLR Version:
4.7 or later [Release Number = 461308]

Peak Virtual Memory:
34 GB

Private Memory:
303 MB

Peak Working Set:
433 MB

IE Version:
11.665.16299.0

User ID:
e91c8a7c-18af-4f62-bb2c-74192dfc0bd8

Workbook Package Info:
1* - en-US, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
False

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\     \Microsoft\Power BI Desktop Store App\FrownSnapShot1338113713.zip

Performance Trace Logs:
C:\Users\     \Microsoft\Power BI Desktop Store App\PerformanceTraces.zip

Disabled Preview Features:
PBI_shapeMapVisualEnabled
MIntellisense
PBI_SpanishLinguisticsEnabled
PBI_PdfImport
PBI_ColumnProfiling
PBI_variationUIChange
PBI_PythonSupportEnabled
PBI_showIncrementalRefreshPolicy
PBI_showManageAggregations
PBI_FuzzyMatching
PBI_EnableWebDiagramView
PBI_improvedFilterExperience

Disabled DirectQuery Options:
PBI_DirectQuery_Unrestricted
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
125%

Supported Services:
Power BI

Formulas:


section Section1;

shared Demo1 = let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NdBLb8IwEATg/+IzQhvH9nqPFGhpSx+UdyNOVThVSETpof+eZCYcv+xm7HFVud+6bevGjdy5qa9/9eXn351GlZt0X8aSi6TgA1gE8+AU9JrJGRh8LMF5z8KrcPrIZZ8z+ERKEcEFmMQC+ExaSuAL2O0y+ZVUZfKS54pn1BuTg/Dfd0ZpMPAD1Chs9MlG5jldMVmMUV9gtMzlNaNKT25Ak8iDtsNrRBbcMcqU3HNaJgEP90bkcbiGsv73cI2epxs=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"letter", type text}, {"frequency", type number}})
in
#"Changed Type1";

shared #"test surface" = let
Source = Csv.Document(File.Contents("C:\Users\310299630\Documents\Projects\DI Pricing\test surface.csv"),[Delimiter=",", Columns=8, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"TPR", type number}, {"C1", type number}, {"C2", type number}, {"C3", type number}, {"SalesVolume", type number}, {"SalesMargin", type number}, {"WinRate", type number}})
in
#"Changed Type";

0 REPLIES 0

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.