0

I have written a function in R as follows:

    createV <- function(vid){
    vid1 = substring(toString(vid),3)
    return(vid1)
     }

I have exposed this function as an api using opencpu

when i call the API where parameter vid = "abcd123", it throws an error saying object not found in call: substring(abcd123)

It treats the variable content as object. How do I fix this?

  • How do uou call/invoke from your client? To pass strings, (for instance with JSON) it is required to enquote such as: `data:{vid: "'abcd123'"}}` (double quote to respect JSON structre, single quote within to be evaluated as string by R) – Eric Lecoutre Jul 27 '16 at 07:57
  • Oh it worked :) Thanks a lot. I was en quoting it only once using double quote. – Amita Mohite Jul 27 '16 at 08:04

0 Answers0