Using the management pack in Rstudio, I am trying to create a scatter chart in which I can select one of several data frames using the collector, and then using the sliders I control the columns that I would like to build for each axis. For example, using these two datasets: mtcars and iris.
library(manipulate)
manipulate(
plot(dataset[, xaxis] ~ dataset[, yaxis],
dataset,
xlab = colnames(dataset)[xaxis],
ylab = colnames(dataset)[yaxis],
main = title),
xaxis = slider(1, 10),
yaxis = slider(1, 10),
dataset = picker("mtcars" = mtcars, "iris" = iris),
title = picker("mtcars", "iris")
)
This works fine, however I am struggling with two questions:
How to dynamically change the chart title based on the selected data set (mtcars or iris) instead of manually using another selection tool, as in the example above. I cannot get the name of the selected data frame and pass it as a character header.
, hardcoding 1 10. , mtcars 11 5. , . , , , , ( ) (). , :
xaxis = (1, as.numeric(dim ( ) [2]))