From: Chalasani, Prasad <prasad.chalasani_at_gs.com>

Date: Thu 28 Apr 2005 - 05:46:18 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Apr 28 05:50:20 2005

Date: Thu 28 Apr 2005 - 05:46:18 EST

assign( 'a', { z <- get('a'); z[1] <- 0; z } )

I am trying to find a way to assign values to elements of a vector that will be defined by a user. So I don't have the name of the vector and cannot hard code the assignment in advance. In the example below I have to get() the vector using its name. When I try to assign to an element I get an error:

> a <- c(1,2,3)

*> get('a')[1] <- 0
*

Error: Target of assignment expands to non-language object

Any suggestions?

FS

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Apr 28 05:50:20 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:27 EST
*