search for: cart2polar

Displaying 3 results from an estimated 3 matches for "cart2polar".

2018 Oct 15
2
sys.call() inside replacement functions incorrectly returns *tmp*
...as a replacement function, so something like: massign (x, y, z) = construct.some list () Obviously, that's not possible. Probably the best example I can think of is converting cartesian coordinates to polar coordinates. Then we might have something like (note, untested, written in my email): cart2polar = function (x, y) list (theta=atan (y / x), r=sqrt (x * x + y * y) ) massign (r, theta) = cart2polar (x, y) Now, I'm considering a multiple assignment operator, so something like: c (theta, r) $<-$ cart2polar (x, y) And while we're on the topic, I'm also considering an attribu...
2018 Oct 16
0
sys.call() inside replacement functions incorrectly returns *tmp*
On Tue, Oct 16, 2018 at 12:03 AM Abs Spurdle <spurdle.a at gmail.com> wrote: > Probably the best example I can think of is converting cartesian > coordinates to polar coordinates. > Then we might have something like (note, untested, written in my email): > cart2polar = function (x, y) > list (theta=atan (y / x), r=sqrt (x * x + y * y) ) > > massign (r, theta) = cart2polar (x, y) > > Now, I'm considering a multiple assignment operator, so something like: > c (theta, r) $<-$ cart2polar (x, y) This is something that comes up occasiona...
2018 Oct 15
4
sys.call() inside replacement functions incorrectly returns *tmp*
Kia Ora Let's say we have: "myreplacementfunction<-" = function (..., value) { call = sys.call () print (as.list (call) ) 0 } Then we call: x = 0 myreplacementfunction (x, y, z) = 0 It will return: [[1]] `myreplacementfunction<-` [[2]] `*tmp*` [[3]] y [[4]] z $value <promise: 0x06fb6968> There's two problems here. Firstly, x has to be defined otherwise we