Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Newbie question: R tool runs in workflow but does not work as a Macro

PAFlores
6 - Meteoroid

Newbie question/issue.

 

I have a "bit" of R that I use to prep data to generate some box and whisker charts that runs in the R Tool but when I try to turn it into a macro that I can reuse it returns a rather ambiguous error (Error: Quartile (4): R-QuartileBody: Error in `[.data.frame`(myList[[i]], c("Measurement")) : ).  Attached is a data file that can be used to test the script and what I am seeing.

 

Below is the body of the R.

 

Can anyone tell me what I am missing?  Or where I have gone wrong? 

 

Thanks in advance for the assistance!

 

Paul

 

--------------------------------------------------------------------

 

My.DataSet<-read.Alteryx("#1", mode="data.frame")
#
myList<-list()
myList=split(My.DataSet,f=My.DataSet$TesterSN)
#
DataList<-list()
for (i in 1:length(myList)){
tmplist<-list('numeric')
tmplist<-myList[[i]][c('Measurement')]
medianValue<-median(as.numeric(as.character(tmplist[[c('Measurement')]])),na.rm=TRUE)
minValue<-min(as.numeric(as.character(tmplist[[c('Measurement')]])),na.rm=TRUE)
maxValue<-max(as.numeric(as.character(tmplist[[c('Measurement')]])),na.rm=TRUE)
StdDevValue<-sd(as.numeric(as.character(tmplist[[c('Measurement')]])),na.rm=TRUE)
quartile<-quantile(as.numeric(as.character(tmplist[[c('Measurement')]])), na.rm=TRUE)
medianValue<-as.data.frame(medianValue)
mlinValue<-as.data.frame(minValue)
maxValue<-as.data.frame(maxValue)
StdDevValue<-as.data.frame(StdDevValue)
Q1=quartile[1]
Q2=quartile[2]
Q3=quartile[3]
Q4=quartile[4]
Q5=quartile[5]
CalcValues<-data.frame()
CalcValues<-data.frame(Q1,Q2,Q3,Q4,Q5,medianValue,minValue, maxValue,StdDevValue)
DataList[[i]]<-CalcValues
}
ResultSet=do.call(rbind, DataList)

write.Alteryx(ResultSet, 1)



 

 

1 REPLY 1
PAFlores
6 - Meteoroid

Figured it out!  Configuration of the Macro Input to process a test input data source cleaned up the issue!

Labels
Top Solution Authors