R example does not work...
mavericksn
New Altair Community Member
I am trying to load a csv file in my R script.Execute R script is the only operator in the program which is connected to the output.(I have printed the xml code below). It gives me an error mentioning
InOrder to import an R data frame as example set the data frame must provide attribute names. The simple file I am trying to load does have the header for the data though..So I am confused..Please help..
Thanks
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.008">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
<process expanded="true" height="235" width="614">
<operator activated="true" class="r:execute_script_r" compatibility="5.2.000" expanded="true" height="76" name="Execute Script (R)" width="90" x="246" y="75">
<parameter key="script" value="datafile = "C:\\dataprojects\\tickstats\\taqlogrstats_0.75.csv" data0<-read.csv(datafile, header=TRUE, stringsAsFactors=FALSE) data1<-as.data.frame(data0) header1<-names(data1) colnames(data1)<-header1"/>
<enumeration key="inputs"/>
<list key="results">
<parameter key="data1" value="Data Table"/>
</list>
</operator>
<connect from_op="Execute Script (R)" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="54"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
InOrder to import an R data frame as example set the data frame must provide attribute names. The simple file I am trying to load does have the header for the data though..So I am confused..Please help..
Thanks
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.008">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
<process expanded="true" height="235" width="614">
<operator activated="true" class="r:execute_script_r" compatibility="5.2.000" expanded="true" height="76" name="Execute Script (R)" width="90" x="246" y="75">
<parameter key="script" value="datafile = "C:\\dataprojects\\tickstats\\taqlogrstats_0.75.csv" data0<-read.csv(datafile, header=TRUE, stringsAsFactors=FALSE) data1<-as.data.frame(data0) header1<-names(data1) colnames(data1)<-header1"/>
<enumeration key="inputs"/>
<list key="results">
<parameter key="data1" value="Data Table"/>
</list>
</operator>
<connect from_op="Execute Script (R)" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="54"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Tagged:
0