Re: [R] Function Error

From: Barry Rowlingson <>
Date: Tue, 22 Jul 2008 20:42:31 +0100

2008/7/22 Angelo Scozzarella <>:
> Hi,
> Why this function doesn't work?

> return(x$breaks[cl]+
> (N/2-sum(x$counts[1:(cl-1)]))/(x$densit[cl]*N)
> } else median(x)
> }

Have you read the error message? I get:

Error: unexpected '}' in:


 which is because you haven't closed the "(" from the "return(" function.

 If you use an editor with syntax highlighting (emacs+ESS, tinn-R, others) it will flash matching brackets and parentheses so you don't make this kind of mistake.

Barry mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Jul 2008 - 20:41:10 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 Tue 22 Jul 2008 - 21:32:51 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive