You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I have an R function that I wish to turn into an API for Tableau and I'd like to use this (awesome!) package. My function doesn't require any arguments and returns a data frame that contains a variety of types. A toy example is included below.
library(plumber)
library(plumbertableau)
#* @apiTitle An example#* @apiDescription Simple example function#* @tableauArg x:[logical] A dummy variable#* @tableauReturn [integer] Returning some stuff#* @post /mtcarsfunction(x) {
mtcars[1:3, ]
}
# The Plumber router modifier tableau_extension is required#* @plumbertableau_extension
When I run this API (through Swagger), I get the following:
Note that I have included tableauArg despite my function not needing any arguments. If I omit this and the argument to my function, I get the following:
Error: Tableau argument and return data types must be specified.
Is there a correct way to omit arguments if they are not needed or do I always have to include a dummy argument like above?
Question 2
Similarly, I must include a data type for tableauReturn. I specify that the return type is an integer, but actually the data frame includes a mixture of integers, doubles, and strings. In Swagger, at least, the response above looks good. How should I specify mixed response data types, like shown in the above example?
Any help would be greatly appreciated and kudos on a stellar package!
Edit:
To follow up on Question 2: it looks like this specifies the SCRIPT_* function that Tableau uses (e.g., SCRIPT_INT in the example above since I specify @tableauReturn [integer]). Given that this is how Tableau and plumbertableau interact, presumably there's no way around this besides returning all data as strings (SCRIPT_STR) and doing the type conversion in Tableau?
The text was updated successfully, but these errors were encountered:
Say I have an R function that I wish to turn into an API for Tableau and I'd like to use this (awesome!) package. My function doesn't require any arguments and returns a data frame that contains a variety of types. A toy example is included below.
When I run this API (through Swagger), I get the following:
This is exactly what I want. Fantastic!
Question 1
Note that I have included
tableauArg
despite my function not needing any arguments. If I omit this and the argument to my function, I get the following:Is there a correct way to omit arguments if they are not needed or do I always have to include a dummy argument like above?
Question 2
Similarly, I must include a data type for
tableauReturn
. I specify that the return type is an integer, but actually the data frame includes a mixture of integers, doubles, and strings. In Swagger, at least, the response above looks good. How should I specify mixed response data types, like shown in the above example?Any help would be greatly appreciated and kudos on a stellar package!
Edit:
To follow up on Question 2: it looks like this specifies the SCRIPT_* function that Tableau uses (e.g., SCRIPT_INT in the example above since I specify
@tableauReturn [integer]
). Given that this is how Tableau and plumbertableau interact, presumably there's no way around this besides returning all data as strings (SCRIPT_STR
) and doing the type conversion in Tableau?The text was updated successfully, but these errors were encountered: