[R] trouble reading in datasets

Clayton Springer csprin at brandybuck.ca.sandia.gov
Mon Oct 25 15:58:01 CEST 1999


Dear All,

I was trying to follow some of the examples in Venables and Ripley "Modern applied ... with S-plus"
I have downloaded a copy of the iris data set and loaded into R. :

however I cannot use the apply command (from p47):

 > apply (iris, 2 ,mean)
Error in sum(..., na.rm = na.rm) : invalid "mode" of argument

> apply (iris, c(2) ,mean)
Error in sum(..., na.rm = na.rm) : invalid "mode" of argument

also

> apply (iris, c(2) ,sum)
Error in sum(..., na.rm = na.rm) : invalid "mode" of argument

So ... any suggestions as to what have I not done here? 

Some commands that show that I did load the dataset.
> iris
     V1  V2  V3  V4              V5
1   5.1 3.5 1.4 0.2     Iris-setosa

....

and
> summary (iris)
       V1              V2              V3              V4       
 Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100  
 1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.600   1st Qu.:0.300  
 Median :5.800   Median :3.000   Median :4.350   Median :1.300  
 Mean   :5.843   Mean   :3.054   Mean   :3.759   Mean   :1.199  
 3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800  
 Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500  
               V5    
 Iris-setosa    :50  
 Iris-versicolor:50  
 Iris-virginica :50  
                     

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list