I still think that fortune(181) applies here. Someday you (or another user
that you give your function to) will run this, then realize that you/they had
an A, B, or c variable that has just been overwritten that you/they wanted to
keep. (also 'c' is one of the variable names recommended agains
As a followup to my question yesterday, what if I were to return the
argument as a list, and then "unwrap" the list with the function I've
written called "objects". Is there any problems with doing it? It
works to use it inside other functions. For example:
=
>
l Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Scott Hyde
> Sent: Tuesday, June 02, 2009 9:30 PM
> To: r-help@r-project.org
> Subject:
I don't know why you want to do this. But you can try _assign_
simple <- function(m,n) {
assign("A",matrix(c(3,3,2,3),2,2),env=.GlobalEnv)
assign("B",m,env=.GlobalEnv)
assign("c",1:n,env=.GlobalEnv)
}
> simple(5,4)
> A
[,1] [,2]
[1,]32
[2,]33
> B
[1] 5
Ronggui
2009/6/3 Sc
I'd like to perform return variable assignments like matlab. For example,
the following function would return A, B, and c to the script that called
it.
=
function [A,B,c] = simple(m,n)
A=[ 3 2; 3 3]
B=m
c=1:n
=
I'd like to do simil
5 matches
Mail list logo