<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic R Script Syntax Help in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/R-Script-Syntax-Help/m-p/130776#M9216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get a working time series forecast in Qlik Sense.&amp;nbsp; At first I tried the Advanced Analytics Toolbox, but the time series components of that extension are broken and do not work as intended.&amp;nbsp; I was able to do the analysis that I wanted in R Studio as a proof of concept, and now I want to reproduce the results in Qlik Sense.&amp;nbsp; The goal is to get ARIMA forecast predictions for each future month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to get simple R scripts to work such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.ScriptEval('variable = q$test; variable',&lt;/P&gt;&lt;P&gt;Sum([REVENUE]) as test&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the data is properly sliced by the dimension in the line graph.&lt;/P&gt;&lt;P&gt;I have written the following analysis in R which correctly creates and ARIMA model and forecasts future periods:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;library(forecast)&lt;/P&gt;&lt;P&gt;library(ggplot2)&lt;/P&gt;&lt;P&gt;#Monthly&lt;/P&gt;&lt;P&gt;arima = read.csv("diagm.csv")&lt;/P&gt;&lt;P&gt;vals = arima$rev&lt;/P&gt;&lt;P&gt;vals = as.numeric(vals)&lt;/P&gt;&lt;P&gt;tsobj = ts(vals, start = c (2014, 10), end = c(2018, 5), frequency = 12)&lt;/P&gt;&lt;P&gt;##ARIMA&lt;/P&gt;&lt;P&gt;ar = auto.arima(tsobj, ic = "bic")&lt;/P&gt;&lt;P&gt;ar&lt;/P&gt;&lt;P&gt;fc = forecast(ar, h = 12)&lt;/P&gt;&lt;P&gt;fc&lt;/P&gt;&lt;P&gt;autoplot(fc) + ggtitle("Monthly Revenue Forecast") + xlab("Month") + ylab("Revenue") +&lt;/P&gt;&lt;P&gt;&amp;nbsp; scale_y_continuous(labels = scales::comma)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By dissecting the code of others I think that my Qlik Sense R script is close, but it is not yielding results.&amp;nbsp; Right now my best try is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.ScriptEval('&lt;/P&gt;&lt;P&gt;library(dplyr);&lt;/P&gt;&lt;P&gt;library(forecast);&lt;/P&gt;&lt;P&gt;data = ts(na.omit(q$Measure), frequency = 12);&lt;/P&gt;&lt;P&gt;fit = auto.arima(data);&lt;/P&gt;&lt;P&gt;res = forecast(fit, h = 12);&lt;/P&gt;&lt;P&gt;as.double(res$mean)',&lt;/P&gt;&lt;P&gt;Sum(REVENUE) as Measure&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you are familiar with forecasting with R in Qlik Sense or if my coding errors are apparent.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jul 2018 12:50:14 GMT</pubDate>
    <dc:creator>elliotmdebruyn</dc:creator>
    <dc:date>2018-07-11T12:50:14Z</dc:date>
    <item>
      <title>R Script Syntax Help</title>
      <link>https://community.qlik.com/t5/App-Development/R-Script-Syntax-Help/m-p/130776#M9216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get a working time series forecast in Qlik Sense.&amp;nbsp; At first I tried the Advanced Analytics Toolbox, but the time series components of that extension are broken and do not work as intended.&amp;nbsp; I was able to do the analysis that I wanted in R Studio as a proof of concept, and now I want to reproduce the results in Qlik Sense.&amp;nbsp; The goal is to get ARIMA forecast predictions for each future month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to get simple R scripts to work such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.ScriptEval('variable = q$test; variable',&lt;/P&gt;&lt;P&gt;Sum([REVENUE]) as test&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the data is properly sliced by the dimension in the line graph.&lt;/P&gt;&lt;P&gt;I have written the following analysis in R which correctly creates and ARIMA model and forecasts future periods:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;library(forecast)&lt;/P&gt;&lt;P&gt;library(ggplot2)&lt;/P&gt;&lt;P&gt;#Monthly&lt;/P&gt;&lt;P&gt;arima = read.csv("diagm.csv")&lt;/P&gt;&lt;P&gt;vals = arima$rev&lt;/P&gt;&lt;P&gt;vals = as.numeric(vals)&lt;/P&gt;&lt;P&gt;tsobj = ts(vals, start = c (2014, 10), end = c(2018, 5), frequency = 12)&lt;/P&gt;&lt;P&gt;##ARIMA&lt;/P&gt;&lt;P&gt;ar = auto.arima(tsobj, ic = "bic")&lt;/P&gt;&lt;P&gt;ar&lt;/P&gt;&lt;P&gt;fc = forecast(ar, h = 12)&lt;/P&gt;&lt;P&gt;fc&lt;/P&gt;&lt;P&gt;autoplot(fc) + ggtitle("Monthly Revenue Forecast") + xlab("Month") + ylab("Revenue") +&lt;/P&gt;&lt;P&gt;&amp;nbsp; scale_y_continuous(labels = scales::comma)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By dissecting the code of others I think that my Qlik Sense R script is close, but it is not yielding results.&amp;nbsp; Right now my best try is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.ScriptEval('&lt;/P&gt;&lt;P&gt;library(dplyr);&lt;/P&gt;&lt;P&gt;library(forecast);&lt;/P&gt;&lt;P&gt;data = ts(na.omit(q$Measure), frequency = 12);&lt;/P&gt;&lt;P&gt;fit = auto.arima(data);&lt;/P&gt;&lt;P&gt;res = forecast(fit, h = 12);&lt;/P&gt;&lt;P&gt;as.double(res$mean)',&lt;/P&gt;&lt;P&gt;Sum(REVENUE) as Measure&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you are familiar with forecasting with R in Qlik Sense or if my coding errors are apparent.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 12:50:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/R-Script-Syntax-Help/m-p/130776#M9216</guid>
      <dc:creator>elliotmdebruyn</dc:creator>
      <dc:date>2018-07-11T12:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: R Script Syntax Help</title>
      <link>https://community.qlik.com/t5/App-Development/R-Script-Syntax-Help/m-p/130777#M9217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Elliot, I have been trying the same with unfortunately very dismal results. Could you tell me what error the R server is showing when you're applying this script? Also, please share the dataset if you can.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2018 12:56:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/R-Script-Syntax-Help/m-p/130777#M9217</guid>
      <dc:creator>adityadey123</dc:creator>
      <dc:date>2018-08-09T12:56:39Z</dc:date>
    </item>
  </channel>
</rss>

