I would like to know how to use table data as a parameter in Tableau's R integration.
Tableau has a builtin data set called "Superstore" used for reproducible examples. Suppose I've used the Superstore data set to create a "text table" (i.e. spreadsheet) with
output <- anRFunction(.arg1)
Tableau will pass the aggregated values to R, depending on the settings of your worksheet.
So in your case if you use:
SCRIPT_REAL(' output <- anRFunction(.arg1) ', sum(Profit))
You will get the output according to the dimensions you have on your worksheet, in your case
[Region] if you set up a filter by country, R will only receive and return the values for a certain country and if you choose to use
[Category] instead, you will get the results of your R function broken down by category.