[R] failure in simple calculation!!

Ko-Kang Kevin Wang k.wang at auckland.ac.nz
Thu Mar 11 01:37:34 CET 2004


Hi,

----- Original Message ----- 
From: "Mike Campana" <mike.campana at freesurf.ch>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, March 11, 2004 12:20 PM
Subject: [R] failure in simple calculation!!


> Hello
>
> I have a dataframe, at least I think I created it by using:
>
> DELTA <- as.data.frame(DELTA)
>
> The dataframe has 2 columns made of numbers("data" and "delta")
>
> If I use   DELTA$delta + 12
> I get a sequence of NA  Warning message:
> "+" not meaningful for factors in: Ops.factor(DELTA$deltatemp, 12)
>
> What does this mean? Can you explain me please why I can not make this
> simple calculation? And what can I do to the calculation?
>
> further information:
> mode(DELTA)
> [1] "list"
>
> DELTA$delta
> .....
> [685] 6.04  7.84  8.01  8.43  6.6   6.33  8.42  8.86  10.25 8.2   9.32
9.77
> [697] 7.9   6.42  5.95
> 474 Levels: -0.02 -0.13 -0.22 -0.46 -0.55 -1.26 -1.83 -1.86 -2.45 -3.2 ...
> 9.9
> What does this last row mean?


Several things.

1) DELTA is not a data frame here.  It is a list: mode(DELTA)

2) DELTA$delta is not a vector.  It is a factor.  For some reason when you
generated DELTA, your delta has become a factor.  Arithematic operations on
factors are meaningless.

HTH.

Kevin

--------------------------------------------
Ko-Kang Kevin Wang, MSc(Hon)
Statistics Workshops Co-ordinator
Student Learning Centre
University of Auckland
New Zealand




More information about the R-help mailing list