0

This is a question that has been answered in context to R, so I should have a similar solution. The problem is, my code works in R but not in Shiny ?

error source

for(i in 1:N)
{

rank_free_choice<- rank_free_choice_fn(signal_agent[i], M, gamma, omega, K,m)

website_choice<- website_choice_fn(rank_data_today,alpha,rank_free_choice)   

t1<- ranking_algo_fn(rank_data_today, website_choice, kappa)

rank_data_today<- t1


df_website_choice[i,]<- website_choice
df_rank_data[i,]<- rank_data_today

}

Both matrices are initialized before the loop begins, and rank_data_today was also created before.

The function continues further, and multiple outputs are put together in a list before returning it outside the function.

Curiously I have another app that runs this code similarly, and that works fine!! In that one the initial rank data is passed to df_rank_data[i,] and the updated are passed to df_rank_data[i+1,]

Anybody with a solution? Or perhaps could explain this answer in my context?

user_cm21
  • 23
  • 6

1 Answers1

0

I figured it out, and since the problem was so bizarre, I'm posting it here in case anyone else runs into a similar problem.

The reason the code wasn't working was because one of the inputs to the function was missing in Shiny!!!!!

So basically it was a plain and simple typo/carelessness but the error didn't really help.

The Shiny app is just a wrapper around a simulation I wrote in R that used functions, taking inputs from other functions. The error only showed up in the penultimate function [No real way to trace it]

It was working in R because I didn't have to separately input any values as I'd already saved the code.

user_cm21
  • 23
  • 6