Dear R Core, working on my dynamic factor modelling package, which requires several subroutines to create and update several system matrices, I come back to the issue of being annoyed by R not supporting multiple assignment out of the box like Matlab, Python and julia. e.g. something like
A, C, Q, R = init_matrices(X, Y, Z) would be a great addition to the language. I know there are several workarounds such as the %<-% operator in the zeallot package or my own %=% operator in collapse, but these don't work well for package development as R CMD Check warns about missing global bindings for the created variables, e.g. I would have to use A <- C <- Q <- R <- NULL .c(A, C, Q, R) %=% init_matrices(X, Y, Z) in a package, which is simply annoying. Of course the standard way of init <- init_matrices(X, Y, Z) A <- init$A; C <- init$C; Q <- init$Q; R <- init$R rm(init) is also super cumbersome compared to Python or Julia. Another reason is of course performance, even my %=% operator written in C has a non-negligible performance cost for very tight loops, compared to a solution at the interpretor level or in a primitive function such as `=`. So my conclusion at this point is that it is just significantly easier to implement such codes in Julia, in addition to the greater performance it offers. There are obvious reasons why I am still coding in R and C, thanks to the robust API and great ecosystem of packages, but adding this could be a presumably low-hanging fruit to make my life a bit easier. Several issues for this have been filed on Stackoverflow, the most popular one ( https://stackoverflow.com/questions/7519790/assign-multiple-new-variables-on-lhs-in-a-single-line) has been viewed 77 thousand times. But maybe this has already been discussed here and already decided against. In that case, a way to browse R-devel archives to find out would be nice. Best regards, Sebastian [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel