Hi Rolf,

Thanks for the warning. I think because my initial efforts used the assign function, that Jim provided his solution using it.

    Any suggestions for how it could be done without assign() ?

Matthew

On 7/11/2016 6:31 PM, Rolf Turner wrote:
On 12/07/16 10:13, Matthew wrote:
Hi Jim,

Wow ! And it does exactly what I was looking for. Thank you very much.

That assign function is pretty nice. I should become more familiar with it.

Indeed you should, and assign() is indeed nice and useful and handy. But it should be used with care and circumspection. It *alters the global environment* which is fraught with peril. Generally speaking most things that can be done with assign() (and its companion function get()) are better and more safely done using lists and functions and other "natural" R-ish constructs. Resist the temptation to turn R into a macro language.

cheers,

Rolf Turner


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to