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 <[EMAIL PROTECTED]> 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@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@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.