Re: [R] setting options only inside functions

From: Jonathan Daily <biomathjdaily_at_gmail.com>
Date: Thu, 28 Apr 2011 08:29:33 -0400

I would also love to see this implemented in R, as my current solution to the issue of doing tons of open/close, dev/dev.off, etc. is to use snippets in my IDE, and in the end I feel like it is a hack job. A pythonic "with" function would also solve most of the situations where I have had to use awkward try or tryCatch calls. I would be willing to help with this project, even if it is just testing.

On Wed, Apr 27, 2011 at 5:43 PM, Barry Rowlingson <b.rowlingson_at_lancaster.ac.uk> wrote:
>> 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
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.
>

-- 
===============================================
Jon Daily
Technician
===============================================
#!/usr/bin/env outside
# It's great, trust me.

______________________________________________
R-help_at_r-project.org mailing list
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.
Received on Thu 28 Apr 2011 - 12:34:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Apr 2011 - 17:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive