I have not figured out why you seem so attached to the c(type)
strategy but try:
> numbers <-summary(rawdata[ , c(type)] )
On Jun 16, 2009, at 12:06 PM, John Fitzgerald wrote:
>
> Hi everyone,
>
> I experience some problems with adressing of data.frames when I
> retrieve
> some information for geographical position (ypos, xpos) ot of a MySQL
> Database and want to perform some simple statistics. The problem is
> adressing the dataframes with a construct like
>
> rawdata[c(type)] vs. rawdata$TEMPMIN
>
>
> to retrieve the numerical information and not a string (I want to
> store the
> numerical values in a database for graphical expression)
>
>
>
> Code Snippet:
>
> type <- "TEMPMIN"
>
> numbers <-summary(rawdata[c(type)])
> numbers2 <- summary(rawdata$TEMPMINIMUM)
>
>
>
> Results:
>
>
> numbers
> TEMPMIN
> Min. :-7.200
> 1st Qu.: 2.100
> Median : 6.200
> Mean : 6.588
> 3rd Qu.:11.800
> Max. :18.100
>
>> numbers[[1]]
> [1] "Min. :-7.200 " <<< which is a string
>
>
>
> Whereas:
>
>> numbers2
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> -7.200 2.100 6.200 6.588 11.800 18.100
>
>> numbers2[[1]]
> [1] -7.2 <<<< which is a numerical value (and can be
easily
> be
> saved in a db)
>
>
>
> I've tried some conversions like (as.matrix, as.list,
> as.data.frame...), but
> still, using the c() construct will change the results of summary() to
> strings. The same happens with median()....
>
>
>
>
> Kind regards,
>
> John Fitzgerald
>
> ______________________________________________
> 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT