Luke,
thanks for your explanation.
I now remember that I was indeed getting an error (instead of a silent
abort) because I did something comparable to a .Call() to "lapply" in
section 5.11 of WRE (Writing R extensions) where expr was the body of a
function f (literally) which contained a retur
If you evaluate return(x) in an evironment env then then that will
execute a return from the function call associated with env or signal
an error if there is none. That is the way return() is intended to
work.
Best,
luke
On Wed, 16 Feb 2011, Duncan Murdoch wrote:
On 11-02-16 7:31 AM, Martin
On 11-02-16 7:31 AM, Martin Becker wrote:
On 15.02.2011 22:48, David Scott wrote:
On 16/02/2011 7:04 a.m., Paul Johnson wrote:
...
4. We don't want gratuitous use of "return" at the end of functions.
Why do people still do that?
Well I for one (and Jeff as well it seems) think it is good
pro
On 15.02.2011 22:48, David Scott wrote:
On 16/02/2011 7:04 a.m., Paul Johnson wrote:
...
4. We don't want gratuitous use of "return" at the end of functions.
Why do people still do that?
Well I for one (and Jeff as well it seems) think it is good
programming practice. It makes explicit what
>From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org]
On Behalf Of Gabor Grothendieck
>Sent: February-15-11 6:10 PM
>On Tue, Feb 15, 2011 at 5:43 PM, wrote:
>>
>> On 2/15/11 4:35 PM, "Gabor Grothendieck" wrote:
>>
>>>I think the real good programming practice is to have a s
> -Original Message-
> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On
> Behalf Of Duncan Murdoch
> Sent: February-15-11 3:10 PM
> To: Kevin Wright
> Cc: R Devel List
> Subject: Re: [Rd] Request: Suggestions for "good teaching"
On 15/02/2011 5:22 PM, Kevin Wright wrote:
For those of you "familiar with R", here's a little quiz. What what's the
difference between:
f1<- function(){
a=5
}
This returns 5, invisibly. It's also bad style, according to those of
us who prefer <- to = for assignment.
f2<- function(){
On Tue, Feb 15, 2011 at 5:43 PM, wrote:
>
> On 2/15/11 4:35 PM, "Gabor Grothendieck" wrote:
>
>>I think the real good programming practice is to have a single point
>>of exit at the bottom.
>
> I disagree, it can be extremely useful to exit early from a function. It
> can also make the code muc
On 16/02/2011 11:43 a.m., ken.willi...@thomsonreuters.com wrote:
On 2/15/11 4:35 PM, "Gabor Grothendieck" wrote:
I think the real good programming practice is to have a single point
of exit at the bottom.
I disagree, it can be extremely useful to exit early from a function. It
can also mak
On 2/15/11 4:35 PM, "Gabor Grothendieck" wrote:
>I think the real good programming practice is to have a single point
>of exit at the bottom.
I disagree, it can be extremely useful to exit early from a function. It
can also make the code much more clear by not having 95% of the body in a
huge
On Tue, Feb 15, 2011 at 4:48 PM, David Scott wrote:
> On 16/02/2011 7:04 a.m., Paul Johnson wrote:
>>
>> Hello,
>>
>> I am looking for CRAN packages that don't teach bad habits. Can I
>> have suggestions?
>>
>> I don't mean the recommended packages that come with R, I mean the
>> contributed ones
f3 <- function() {
( a <- 5 )
}
f4 <- function() {
a <- 5
a
}
On my machine f1,f2, and f4 all perform approx. the same. The () in
f3 adds about 20% overhead.
Jeff
On Tue, Feb 15, 2011 at 4:22 PM, Kevin Wright wrote:
> For those of you "familiar with R", here's a little quiz. What what'
f1 <- function(){
a=5
}
The primary difference is that function 1 uses an incorrect assignment
operator in an attempt to cause confusion ;)
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
For those of you "familiar with R", here's a little quiz. What what's the
difference between:
f1 <- function(){
a=5
}
f1()
f2 <- function(){
return(a=5)
}
f2()
Kevin Wright
On Tue, Feb 15, 2011 at 3:55 PM, Geoff Jentry wrote:
> On Wed, 16 Feb 2011, David Scott wrote:
>
>> 4. We don't
On Wed, 16 Feb 2011, David Scott wrote:
4. We don't want gratuitous use of "return" at the end of functions.
Why do people still do that?
Well I for one (and Jeff as well it seems) think it is good programming
practice. It makes explicit what is being returned eliminating the
possibility of mis
On 16/02/2011 7:04 a.m., Paul Johnson wrote:
Hello,
I am looking for CRAN packages that don't teach bad habits. Can I
have suggestions?
I don't mean the recommended packages that come with R, I mean the
contributed ones. I've been sampling a lot of examples and am
surprised that many ignore s
Hi Paul,
You might want to post this to the teaching list (R-sig-teaching). I'd
look at packages written by old-timers and R Core. I've also found that
most Bioconductor packages follow the guidelines you mention and many
other excellent habits very well. I agree with you that these are very
im
On Tue, Feb 15, 2011 at 1:04 PM, Paul Johnson wrote:
> Hello,
>
> I am looking for CRAN packages that don't teach bad habits. Can I
> have suggestions?
>
> I don't mean the recommended packages that come with R, I mean the
> contributed ones. I've been sampling a lot of examples and am
> surpris
I think for teaching, you need to use R itself.
Everything else is going to be a derivative from that, and if you are
looking for 'correctness' or 'consistency' with the spirit of R, you
can only be disappointed - as everyone will take liberties or bring
personal style into the equation.
In addit
I think my recent packages are pretty good. In particular, I'd
recommend string, plyr and testthat as being well written, well
documented and (somewhat) well tested. I've also been trying to write
up the process of writing good packages. See
https://github.com/hadley/devtools/wiki for my thoughts
Hello,
I am looking for CRAN packages that don't teach bad habits. Can I
have suggestions?
I don't mean the recommended packages that come with R, I mean the
contributed ones. I've been sampling a lot of examples and am
surprised that many ignore seemingly agreed-upon principles of R
coding. In
21 matches
Mail list logo