you can integrate R formula into your tableau workbook but not embed R
see the video link below
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
This is not a suitable use of Tableau Desktop’s R integration as of at least v2019.3. The reason why is that the current R integration in Desktop runs as a table calculation and therefore the view (worksheet) has to have exactly the same number of marks (rows) as you want to return from the R function. There’s a possible additional reason...of your R code is returning multiple fields per row then you’d need to do extra parsing in Tableau that can negatively impact performance. The current R integration in Desktop is designed to run on the data that you have in a view, not create a new data source.
Therefore I’d suggest running the R code outside of Desktop and use that as your Tableau data source.
Note that Tableau Prep v2019.3 (in beta) has a new R/Python script step that could run the web scraping code inside Prep, however it would still need a one row source to get started.
Thanks for info Jonathan, that's mean tableau desktop can't handle r script.
Thanks Jim for answer, like I already mentioned I had already tried with rserve package this technique, it work when I am working some ML model, where I am giving some input to get the output results (scalar output), but this time my script is so long (1200+ lines) which returns the tabular data.