cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alexei Frequent Visitor
Frequent 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";

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 546 members 4,523 guests
Please welcome our newest community members: