cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
tracymr Frequent Visitor
Frequent Visitor

R scripting error

Getting an error trying to generate the following:

# 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(CI_DATE, JVM_BUSY_MAX)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(ggplot2)
mean<-mean(dataset$JVM_BUSY_MAX)
sd<-sd(dataset$JVMBUSY_MAX)
y<-dnorm(dataset$JVM_BUSY_MAX,mean,sd)
plot(dataset$JVM_BUSY_MAX, y, xlab = "x value", ylab="Density",type="|",main="Comparison of t values")
y
 
Here is my error file:
 

Feedback Type:
Frown (Error)

Timestamp:
2019-10-03T16:54:20.9055551Z

Local Time:
2019-10-03T12:54:20.9055551-04:00

Session ID:
07844f89-cca1-43cf-86fa-69fd3f0686c6

Release:
September 2019

Product Version:
2.73.5586.661 (19.09) (x64)

Error Message:
R script error.
Error in plot.window(...) : need finite 'ylim' values
Calls: plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
Execution halted


Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: R script error.
Error in plot.window(...) : need finite 'ylim' values
Calls: plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
Execution halted
---> Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException: R script error.
Error in plot.window(...) : need finite 'ylim' values
Calls: plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
Execution halted

at Microsoft.PowerBI.Scripting.R.RScriptWrapper.RunScript(String originalScript, Int32 timeoutMs)
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
--- End of inner exception stack trace ---
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.Run(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.TransformDataShapeResult(QueryCommand transformCommand, SemanticQueryDataShapeCommand command, Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ExecuteDataQuery(IQueryResultDataWriter queryResultDataWriter, EngineDataModel engineDataModel, DataQuery query, Int32 queryId, ServiceErrorStatusCode& serviceErrorStatusCode, CancellationToken cancelToken)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ProcessAndWriteSemanticQueryCommands(IQueryResultsWriter queryResultsWriter, IList`1 queries, HashSet`1 pendingQueriesToCancel, EngineDataModel engineDataModel)

Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.GetErrorDetails(ShowErrorDialogArgs args)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass2_0.<<ShowErrorDialog>b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass2_0.<ShowErrorDialog>b__0()
at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass1_0`1.<SendAndMarshalExceptions>b__0()
at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass0_1.<SendAndMarshalExceptions>b__0(Object null)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.UI.Shared.WebDialogs.WebDialog.<>n__0(IWindowHandle owner)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClass4_0.<Main>b__1()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)


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

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

Peak Virtual Memory:
35.7 GB

Private Memory:
701 MB

Peak Working Set:
899 MB

IE Version:
11.1331.16299.0

User ID:
ecd8bf56-843e-4490-b67c-dbace5850013

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

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\tracymr\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot612800128.zip

Performance Trace Logs:
C:\Users\tracymr\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_NewWebTableInference
PBI_userFavoriteResourcePackagesEnabled
PBI_tenantOutOfBoxVisualsEnabled
PBI_personalVisualizationPaneEnabled

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_showIncrementalRefreshPolicy
PBI_qnaLiveConnect

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared PS_CI_NET_SOCKET = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_NET_SOCKET1 = SYSADM{[Name="PS_CI_NET_SOCKET"]}[Data],
#"Added Index" = Table.AddIndexColumn(PS_CI_NET_SOCKET1, "Index", 1, 1),
#"Removed Columns" = Table.RemoveColumns(#"Added Index",{"Index"}),
#"Sorted Rows" = Table.Sort(#"Removed Columns",{{"PM_DOMAIN_NAME", Order.Ascending}})
in
#"Sorted Rows";

shared PS_CI_WEBSITE_STAT = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_WEBSITE_STAT1 = SYSADM{[Name="PS_CI_WEBSITE_STAT"]}[Data]
in
PS_CI_WEBSITE_STAT1;

shared PS_CI_WS_SERVLET = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_WS_SERVLET1 = SYSADM{[Name="PS_CI_WS_SERVLET"]}[Data]
in
PS_CI_WS_SERVLET1;

shared PS_CI_JVM_STAT = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_JVM_STAT1 = SYSADM{[Name="PS_CI_JVM_STAT"]}[Data]
in
PS_CI_JVM_STAT1;

shared PS_CI_ELAP_PIA = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_ELAP_PIA1 = SYSADM{[Name="PS_CI_ELAP_PIA"]}[Data],
#"Duplicated Column" = Table.DuplicateColumn(PS_CI_ELAP_PIA1, "PPM_TRANS_TIME", "PPM_TRANS_TIME - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"PPM_TRANS_TIME - Copy", "CI_DATE"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"CI_DATE", type date}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"CI_DATE"}, #"CNG Close", {"date"}, "CNG Close", JoinKind.LeftOuter),
#"Expanded CNG Close" = Table.ExpandTableColumn(#"Merged Queries", "CNG Close", {"year", "month", "day", "quarter", "day_num", "close_day", "close_num", "close_period", "description"}, {"CNG Close.year", "CNG Close.month", "CNG Close.day", "CNG Close.quarter", "CNG Close.day_num", "CNG Close.close_day", "CNG Close.close_num", "CNG Close.close_period", "CNG Close.description"})
in
#"Expanded CNG Close";

shared PS_CI_ELAP_PORTAL = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_ELAP_PORTAL1 = SYSADM{[Name="PS_CI_ELAP_PORTAL"]}[Data]
in
PS_CI_ELAP_PORTAL1;

shared PS_CI_ELAP_APP = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_ELAP_APP1 = SYSADM{[Name="PS_CI_ELAP_APP"]}[Data],
#"Duplicated Column" = Table.DuplicateColumn(PS_CI_ELAP_APP1, "PM_HOST_PORT", "PM_HOST_PORT - Copy"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "PM_HOST_PORT - Copy", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"PM_HOST_PORT - Copy.1", "PM_HOST_PORT - Copy.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Split Column by Delimiter",{{"PM_HOST_PORT - Copy.1", "CI_HOST_NAME"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"PM_HOST_PORT - Copy.2"}),
#"Duplicated Column1" = Table.DuplicateColumn(#"Removed Columns", "DBNAME", "DBNAME - Copy"),
#"Duplicated Column2" = Table.DuplicateColumn(#"Duplicated Column1", "CI_HOST_NAME", "CI_HOST_NAME - Copy"),
#"Merged Columns" = Table.CombineColumns(#"Duplicated Column2",{"DBNAME - Copy", "CI_HOST_NAME - Copy"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"DB_Server"),
#"Duplicated Column3" = Table.DuplicateColumn(#"Merged Columns", "PPM_TRANS_TIME", "PPM_TRANS_TIME - Copy"),
#"Inserted Date" = Table.AddColumn(#"Duplicated Column3", "Date", each DateTime.Date([#"PPM_TRANS_TIME - Copy"]), type date),
#"Renamed Columns1" = Table.RenameColumns(#"Inserted Date",{{"Date", "CI_DATE"}}),
#"Merged Queries" = Table.NestedJoin(#"Renamed Columns1", {"CI_DATE"}, #"CNG Close", {"date"}, "CNG Close", JoinKind.LeftOuter),
#"Expanded CNG Close" = Table.ExpandTableColumn(#"Merged Queries", "CNG Close", {"year", "month", "day", "quarter", "day_num", "close_day", "close_num", "close_period", "description"}, {"CNG Close.year", "CNG Close.month", "CNG Close.day", "CNG Close.quarter", "CNG Close.day_num", "CNG Close.close_day", "CNG Close.close_num", "CNG Close.close_period", "CNG Close.description"})
in
#"Expanded CNG Close";

shared PS_CI_ELAP_TOT = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_ELAP_TOT1 = SYSADM{[Name="PS_CI_ELAP_TOT"]}[Data]
in
PS_CI_ELAP_TOT1;

shared PS_CI_KPI_USR_RESP = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_KPI_USR_RESP1 = SYSADM{[Name="PS_CI_KPI_USR_RESP"]}[Data]
in
PS_CI_KPI_USR_RESP1;

shared PS_CI_COMPONENTS = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_COMPONENTS1 = SYSADM{[Name="PS_CI_COMPONENTS"]}[Data]
in
PS_CI_COMPONENTS1;

shared PS_CI_USER_SUM = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_USER_SUM1 = SYSADM{[Name="PS_CI_USER_SUM"]}[Data],
#"Merged Queries" = Table.NestedJoin(PS_CI_USER_SUM1,{"PM_SIGNOFF_TYPE"},PS_CI_LOGOFF_CD,{"FIELDVALUE"},"PS_CI_LOGOFF_CD (2)",JoinKind.LeftOuter),
#"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"PS_CI_LOGOFF_CD (2)"}),
#"Merged Queries1" = Table.NestedJoin(#"Removed Columns",{"PM_SIGNOFF_TYPE"},PS_CI_LOGOFF_CD,{"FIELDVALUE"},"PS_CI_LOGOFF_CD (2)",JoinKind.LeftOuter),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Merged Queries1", {"PS_CI_LOGOFF_CD (2)"}),
#"Expanded PS_CI_LOGOFF_CD (2)" = Table.ExpandTableColumn(#"Removed Errors", "PS_CI_LOGOFF_CD (2)", {"XLATLONGNAME"}, {"PS_CI_LOGOFF_CD (2).XLATLONGNAME"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded PS_CI_LOGOFF_CD (2)", each true),
#"Duplicated Column" = Table.DuplicateColumn(#"Filtered Rows", "PPM_TRANS_TIME", "PPM_TRANS_TIME - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"PPM_TRANS_TIME - Copy", "CI_DATE"}}),
#"Extracted Date" = Table.TransformColumns(#"Renamed Columns",{{"CI_DATE", DateTime.Date, type date}}),
#"Merged Queries2" = Table.NestedJoin(#"Extracted Date", {"CI_DATE"}, #"CNG Close", {"date"}, "CNG Close", JoinKind.LeftOuter),
#"Expanded CNG Close" = Table.ExpandTableColumn(#"Merged Queries2", "CNG Close", {"year", "month", "day", "quarter", "day_num", "close_day", "close_num", "close_period", "description"}, {"CNG Close.year", "CNG Close.month", "CNG Close.day", "CNG Close.quarter", "CNG Close.day_num", "CNG Close.close_day", "CNG Close.close_num", "CNG Close.close_period", "CNG Close.description"})
in
#"Expanded CNG Close";

shared PS_CI_LOGOFF_CD = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_LOGOFF_CD1 = SYSADM{[Name="PS_CI_LOGOFF_CD"]}[Data]
in
PS_CI_LOGOFF_CD1;

shared PS_CI_PRCS_SUM = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_PRCS_SUM1 = SYSADM{[Name="PS_CI_PRCS_SUM"]}[Data]
in
PS_CI_PRCS_SUM1;

shared PS_CI_USERS = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_USERS1 = SYSADM{[Name="PS_CI_USERS"]}[Data]
in
PS_CI_USERS1;

shared PS_CI_REGIONS = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_REGIONS1 = SYSADM{[Name="PS_CI_REGIONS"]}[Data]
in
PS_CI_REGIONS1;

shared PS_CI_USER_COUNTRY = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_USER_COUNTRY1 = SYSADM{[Name="PS_CI_USER_COUNTRY"]}[Data]
in
PS_CI_USER_COUNTRY1;

shared PS_CI_HOST = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_HOST1 = SYSADM{[Name="PS_CI_HOST"]}[Data],
#"Duplicated Column" = Table.DuplicateColumn(PS_CI_HOST1, "DBNAME", "DBNAME - Copy"),
#"Duplicated Column1" = Table.DuplicateColumn(#"Duplicated Column", "CI_HOST_NAME", "CI_HOST_NAME - Copy"),
#"Merged Columns" = Table.CombineColumns(#"Duplicated Column1",{"DBNAME - Copy", "CI_HOST_NAME - Copy"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"DB_Server"),
#"Filtered Rows" = Table.SelectRows(#"Merged Columns", each ([DBNAME] <> "Dev."))
in
#"Filtered Rows";

shared PS_CI_REPORT_RUN = let
Source = Oracle.Database("pdfse1sn", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_REPORT_RUN1 = SYSADM{[Name="PS_CI_REPORT_RUN"]}[Data],
#"Renamed Columns" = Table.RenameColumns(PS_CI_REPORT_RUN1,{{"CI_REPORT_DATE", "Refreshed Date"}})
in
#"Renamed Columns";

shared PS_CI_HOST_PERFORM = let
Source = Oracle.Database("PDFSE1SN", [HierarchicalNavigation=true]),
SYSADM = Source{[Schema="SYSADM"]}[Data],
PS_CI_HOST_PERFORM1 = SYSADM{[Name="PS_CI_HOST_PERFORM"]}[Data],
#"Duplicated Column" = Table.DuplicateColumn(PS_CI_HOST_PERFORM1, "RUNDTTM", "RUNDTTM - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"RUNDTTM - Copy", "CI_DATE"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"CI_DATE", type date}})
in
#"Changed Type";

shared #"CNG Close" = let
Source = Excel.Workbook(File.Contents("C:\Temp\2019_monthly_dates_updated_period.xlsx"), null, true),
#"CNG Close_Sheet" = Source{[Item="CNG Close",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"CNG Close_Sheet", [PromoteAllScalars=true])
in
#"Promoted Headers";

 

Sample Data Ranges between 0 and 10 with no 'N/A' or blanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-qiuyu-msft
Moderator

Re: R scripting error

Hi @tracymr

 

When you calculated sd<-sd(dataset$JVMBUSY_MAX), you missed the "_" when you referenced the column in sd() function, so sd always returned NA then caused y return NA. Also when you defined the Type parameter value in plot() function, the value "|" you specified is invalid, we need to specify "l" for it. See: https://www.rdocumentation.org/packages/graphics/versions/3.6.1/topics/plot

 

Please modify your R script like below: 

 

# 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(CI_DATE, JVM_BUSY_MAX)
# dataset <- unique(dataset)

# Paste or type your script code here:
# Paste or type your script code here:
library(ggplot2)
mean<-mean(dataset$JVM_BUSY_MAX)
sd<-sd(dataset$JVM_BUSY_MAX)
y<-dnorm(dataset$JVM_BUSY_MAX,mean,sd)
plot(dataset$JVM_BUSY_MAX, y, xlab = "x value", ylab="Density",type="l",main="Comparison of t values")

 

q3.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Moderator v-qiuyu-msft
Moderator

Re: R scripting error

Hi @tracymr

 

When you calculated sd<-sd(dataset$JVMBUSY_MAX), you missed the "_" when you referenced the column in sd() function, so sd always returned NA then caused y return NA. Also when you defined the Type parameter value in plot() function, the value "|" you specified is invalid, we need to specify "l" for it. See: https://www.rdocumentation.org/packages/graphics/versions/3.6.1/topics/plot

 

Please modify your R script like below: 

 

# 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(CI_DATE, JVM_BUSY_MAX)
# dataset <- unique(dataset)

# Paste or type your script code here:
# Paste or type your script code here:
library(ggplot2)
mean<-mean(dataset$JVM_BUSY_MAX)
sd<-sd(dataset$JVM_BUSY_MAX)
y<-dnorm(dataset$JVM_BUSY_MAX,mean,sd)
plot(dataset$JVM_BUSY_MAX, y, xlab = "x value", ylab="Density",type="l",main="Comparison of t values")

 

q3.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 48 members 1,247 guests
Please welcome our newest community members: