I have a SpatialLinesDataFrame named df with a number of attributes. These attributes represent the permutations of three dimensions:
dim1dim2dim3
The attributes thus are:
df$dim1a.dim2a.dim3adf$dim1a.dim2a.dim3bdf$dim1a.dim2b.dim3a- ...
df$dim1b.dim2a.dim3adf$dim1b.dim2a.dim3b- ...
df$dim1n.dim2n.dim3n
I am now trying to make my data accessible in Shiny, where I offer a widget item for each dimensions that allows the user select one value for that dimension. If the user selects
dim1adim2cdim3b
I want to display data for df$dim1a.dim2c.dim3b.
How can I dynamically access the part of the data frame that the user is asking to have displayed?
I can construct the name of the attribute by constructing it via
display_data <- paste0(input$radioButton_dim1,'.',input$radioButton_dim2,'.',input$radioButton_dim3)
But how can I refer to it when trying to select it from the df or subset the data frame to select the data?
+++ Update:
When I try subsetting the data frame by using df[,display_data], the objects of class "Lines" are being returned. If I just use df$dim1a.dim2c.dim3b, I get a list of the actual attribute values for those objects, which is what I am looking for.
+++
If this is not easily feasible or not recommended for some reason, can something like melting/casting also be performed on a SpatialLinesDataFrame?