Function "assign"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Function "assign"

Marco Venanzi
I'm trying to apply the function "assign( )" to a subset of a matrix, but it doesn't work...

i.e.

example<-matrix(nrow=5,ncol=5)
assign("example[c(1,3),]",matrix(1:10,nrow=2,ncol=5))

but matrix "example" doesn't change ( get("example[c(1,3),]") is not useful to me)...how can I do this assignment?
Thanks in advance,

                                          Marco
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Function "assign"

Ferdinand Alimadhi
example<-matrix(nrow=5,ncol=5)
example[c(1,3),]<-matrix(1:10,nrow=2,ncol=5)



Marco Venanzi wrote:

>I'm trying to apply the function "assign( )" to a subset of a matrix, but it doesn't work...
>
>i.e.
>
>example<-matrix(nrow=5,ncol=5)
>assign("example[c(1,3),]",matrix(1:10,nrow=2,ncol=5))
>
>but matrix "example" doesn't change ( get("example[c(1,3),]") is not useful to me)...how can I do this assignment?
>Thanks in advance,
>
>                                          Marco
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>


--
Ferdinand Alimadhi
Programmer / Analyst
Harvard University
The Institute for Quantitative Social Science
(617) 496-0187
[hidden email]
www.iq.harvard.edu

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html