2008/7/22 Angelo Scozzarella <[EMAIL PROTECTED]>:
> 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:
":(cl-1)]))/(x$densit[cl]*
At a first guess, because you are missing a right paren in thereturn()
statement of the final else section.
Otherwise, we'd need to know about what "doesn't work" means -
what is x supposed to be? What do you want the function to do?
What error messages are you getting?
You haven't provided any o
problem.
Cheers
Anna
- Messaggio originale -
Da: Angelo Scozzarella <[EMAIL PROTECTED]>
A: r-help@r-project.org
Inviato: Martedì 22 luglio 2008, 20:51:05
Oggetto: [R] Function Error
Hi,
Why this function doesn't work?
function (x)
{
if (is.factor(x)) {
if (!i
Please give commented, minimal, self-contained, reproducible code. In
this case, not only the function definition, but a simple example
showing *how* it does not work, and what you were expecting it to do!
Angelo Scozzarella wrote:
Hi,
Why this function doesn't work?
function (x)
{
if (
Hi,
Why this function doesn't work?
function (x)
{
if (is.factor(x)) {
if (!is.ordered(x)) {
warning("La mediana non si puo' calcolare!!!")
return(NA)
}
me <- median(unclass(x))
if (me - floor(me) != 0) {
warning("Mediana in
5 matches
Mail list logo