Re: [R] (no subject)

From: jim holtman <jholtman_at_gmail.com>
Date: Sun, 13 Jul 2008 16:46:49 -0400

What does 'str(dat)' show? the statement

dat <- as.numeric(dat)

says you are trying to make an entire dataframe numeric. This is probably not what you want to do. What is it you want to do? Have you tried

summary(dat)

e.g.,

> x <- data.frame(a=1:10, b=101:110, c=letters[1:10])
> summary(x)

       a               b               c
 Min.   : 1.00   Min.   :101.0   a      :1
 1st Qu.: 3.25   1st Qu.:103.2   b      :1
 Median : 5.50   Median :105.5   c      :1
 Mean   : 5.50   Mean   :105.5   d      :1
 3rd Qu.: 7.75   3rd Qu.:107.8   e      :1
 Max.   :10.00   Max.   :110.0   f      :1
                                 (Other):4


On Sun, Jul 13, 2008 at 4:05 PM, Paul Adams <pma3622_at_yahoo.com> wrote:
> Hello everyone,
> I am using the following code to try to calculate the mean :
> dat<-read.table(file="C:\\Documents and Settings.....txt")
> dat<-as.numeric(dat)
> x1.m<mean(dat)
> I am getting the following error message
> Error in eval.with.vis(expr,envir,enclos):
> (list) object cannot be coerced to type"double'
> I do not understand what is wrong as I thought that I have changed
> dat to a numeric.Whenever I list x1.m all I get are NA
> Thank you
> Paul
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 13 Jul 2008 - 20:53:52 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 Sun 13 Jul 2008 - 22:31:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive