Search code examples
rspotfire

Assigning a list to column properties


I have a list containing values and I want to assign it to the column properties of a table in spotfire. I am currently using a for loop to do it. Is there a better approach to this, like assigning the entire list in one go?

As mentioned previously I am doing it currently using a for loop which can be seen below:

high=c(5,2,10)
low=c(3,1,0)
for(col in 1:ncol(temp)){
   attributes(temp[,col])$SpotfireColumnMetaData$limits.whatif.upper=(high[col])[1]
   attributes(temp[,col])$SpotfireColumnMetaData$limits.whatif.lower=(low[col)[1]
    }
}

I have also tried just to do

attributes(temp2)$SpotfireColumnData$limits.whatif.upper=high

but that didnt seem to work.

So I want the column for limits.whatif.upper to be 5 for the first row, 2 for the second, and 10 for the third. As I said this code works, but I want to see if there is a faster way of doing it, since it seems that accessing the column property every time and changing it slows down the code a lot.The columns properties already exist so I am not creating new ones with this code.


Solution

  • It seems that python works faster than R with column properties. So if you need to do it faster, it may be better just to transfer the data over to python and do it from there. I dont have as much expierence in R, so it may just be poorly written R code as well.