[R] Assigning to multiple variables

Gabor Grothendieck ggrothendieck at gmail.com
Sun Apr 13 23:26:50 CEST 2008

Normally in R one returns a list and assigns that to a single
variable but if you really want to do it here is how:


On Sun, Apr 13, 2008 at 4:56 PM, Scott Romans <scott.romans at mac.com> wrote:
> If we have a function that returns 2 or more values (such as dim as
> applied to a matrix), can we assign these 2 or more values to an equal
> number of differently named variables in one line? For example, is
> there any way to do something like this:
> [NumberRows NumberColumns] <- dim(MatrixA)
> Thanks in advance!
> Scott
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list