Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法从操纵包中的滑块控件中提取当前值?例如:
library(manipulate) xx <- seq(-pi, pi, pi/20) manipulate( plot(xx, sin(par.a*xx)), par.a = slider(-3, 3, step=0.01, initial = 1))
玩完滑块后,我想获得 的值以par.a进行进一步计算,而不必每次都查看控件并手动编写它。
par.a
我自己想通了。
可以使用全局变量
manipulate( {plot(xx, sin(par.a*xx)) a <<- par.a}, par.a = slider(-3, 3, step=0.01, initial = 1))
也许它会对某人有所帮助。