In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

R Tool - Object not found

antelk
5 - Atom

Have some very basic code per below. The code fails however at the last line with the error: Error: R (1): Error in `[.data.frame`(inputs, i, FSYM_ID) : object 'FSYM_ID' not found. I'm sure it is something simple, however it is my first time using R in Alteryx.. The same-ish code works fine in R Studio. Thanks for your help.

 

requiredPackages <- c("gtrendsR","jsonlite","curl","stringr","lubridate","data.table","forecast","xts","zoo","scales","RODBC","dplyr")
new.packages <- requiredPackages[!(requiredPackages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages, repos="https://cran.ms.unimelb.edu.au/")

library(gtrendsR)
library(jsonlite)
library(curl)
library(stringr)
library(lubridate)
library(data.table)
library(forecast)
library(xts)
library(zoo)
library(scales)
library(RODBC)
library(dplyr)

runTime_UTC <- now("UTC")

#stock parameters
inputs <- data.frame(read.Alteryx("#1",mode="data.frame"))
write.Alteryx(inputs, 1)

#global parameters
monthly <- T #frequency, set F for daily 5Y
regions <- c("","US","GB") # "" = worldwide

#iterate over inputs and generate a list of plots
outputData <- lapply(1:nrow(inputs),function(i){

FSYM_ID <- inputs[i,FSYM_ID]

..... (continued)

 

2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

I'll start by saying I'm far from the first person you'd ask for R help.

 

If i understand this correctly, you have a field in your #1 input called FSYM_ID that you'd like to reference on its own. In that case:

 

FSYM_ID <- inputs[i,FSYM_ID]

should be

FSYM_ID <- inputs$FSYM_ID

 

Is that what you're going for?

antelk
5 - Atom

That's perfect. Have changed the code to:

 

FSYM_ID <- inputs$FSYM_ID[i] 

 

And it works now. I'm guessing its a R version issue. Thanks for your help.

Labels
Top Solution Authors