<?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 How to run R script on data from a Splunk search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123669#M184226</link>
    <description>&lt;P&gt;I wrote a R script that I'd like to run on data from a search in Splunk. &lt;BR /&gt;
Unfortunately, the only examples of R scripts in Splunk do not use search data. How should I call my search data within the R commands? Currently, it does not recognize the data. &lt;/P&gt;

&lt;P&gt;For example, if I wanted to run the script 'myscript.r' on search result data, how would I reference that data from a search in this command?&lt;BR /&gt;
| r "&lt;BR /&gt;
source('myscript.r')&lt;BR /&gt;
result = myscript( data )&lt;BR /&gt;
output = data.frame(Result=c(result))&lt;BR /&gt;
"&lt;/P&gt;

&lt;P&gt;When I run similar commands on my data I get the error&lt;BR /&gt;
'command="r", object 'data' not found'&lt;/P&gt;

&lt;P&gt;Any suggestions? Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2015 17:24:07 GMT</pubDate>
    <dc:creator>clongo01</dc:creator>
    <dc:date>2015-04-06T17:24:07Z</dc:date>
    <item>
      <title>How to run R script on data from a Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123669#M184226</link>
      <description>&lt;P&gt;I wrote a R script that I'd like to run on data from a search in Splunk. &lt;BR /&gt;
Unfortunately, the only examples of R scripts in Splunk do not use search data. How should I call my search data within the R commands? Currently, it does not recognize the data. &lt;/P&gt;

&lt;P&gt;For example, if I wanted to run the script 'myscript.r' on search result data, how would I reference that data from a search in this command?&lt;BR /&gt;
| r "&lt;BR /&gt;
source('myscript.r')&lt;BR /&gt;
result = myscript( data )&lt;BR /&gt;
output = data.frame(Result=c(result))&lt;BR /&gt;
"&lt;/P&gt;

&lt;P&gt;When I run similar commands on my data I get the error&lt;BR /&gt;
'command="r", object 'data' not found'&lt;/P&gt;

&lt;P&gt;Any suggestions? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 17:24:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123669#M184226</guid>
      <dc:creator>clongo01</dc:creator>
      <dc:date>2015-04-06T17:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to run R script on data from a Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123670#M184227</link>
      <description>&lt;P&gt;The data passed to the R script is accessible thought the "input" variable. The result must be assigned to the "output" variable. &lt;/P&gt;

&lt;P&gt;So either pass the script "inline" in quotes like this: | r " temp = some_r_function(input) \n output = another_r_function(temp) "&lt;BR /&gt;
Or just name the R script (that you need to upload) like this: | r myscript.r&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123670#M184227</guid>
      <dc:creator>rfujara_splunk</dc:creator>
      <dc:date>2020-09-28T19:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to run R script on data from a Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123671#M184228</link>
      <description>&lt;P&gt;Hi @rfujara_splunk, can you please give me info on how to run it on splunk. I am also getting the same error as "No Data" when it is been saved as dashboard. am trying to use chart command. like as &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source = "loan_amount.csv" | 
r "
source('cal04.r') 
output=cast()
" | chart output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is it correct form to use.?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Santhosh.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 07:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123671#M184228</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-06-10T07:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to run R script on data from a Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123672#M184229</link>
      <description>&lt;P&gt;r command is not avail....&lt;BR /&gt;
splunk is not work... just stop status&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 07:33:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-run-R-script-on-data-from-a-Splunk-search/m-p/123672#M184229</guid>
      <dc:creator>leeyounsoo</dc:creator>
      <dc:date>2018-05-29T07:33:44Z</dc:date>
    </item>
  </channel>
</rss>

