[R] setting options only inside functions
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Wed Apr 27 23:43:24 CEST 2011
> but it's a little clumsy, because
>
> with_connection(file("myfile.txt"), {do stuff...})
>
> isn't very useful because you have no way to reference the connection
> that you're using. Ruby's blocks have arguments which would require
> big changes to R's syntax. One option would to use pronouns:
Looking very much like python 'with' statements:
http://effbot.org/zone/python-with-statement.htm
Implemented via the 'with' statement which can operate on anything
that has a __enter__ and an __exit__ method. Very neat.
Barry
More information about the R-help
mailing list