jcb wrote:
Hello,
I'm a new R user and I'm having a little trouble getting started. I'm
hoping
someone can help me out. I read numbers (integer) from a SQL database.
Some calculations as mean()are possible but hist() give an error. Here
are the commands:
library(RMySQL)
Loading required package: DBI
> con <- dbConnect(dbDriver("MySQL"), dbname = "test")
> dbListTables(con)
[1] "individu"
res <- dbSendQuery(con,"select taille from individu")
> data <- fetch(res,-1)
> data
taille
1 184
2 175
3 189
4 173
5 169
6 175
7 164
8 190
9 174
10 184
11 168
12 179
13 174
14 163
15 175
16 176
17 190
18 172
19 178
20 173
> mean(data)
taille
176.25
> hist(data)
Error in hist.default(data) : `x' must be numeric
What can I do to draw the histogram ?
data is a data.frame, instead use:
hist(data$taille)
Uwe Ligges
Thanks for your time
JC Bartier
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html