[R] dotchart() help

From: Alexander Nervedi <alexnerdy_at_hotmail.com>
Date: Tue 12 Sep 2006 - 00:12:54 GMT


Hi

I am having trouble with dotcharts, and I keep getting the error message:

Error in Summary.data.frame(..., na.rm = na.rm) :

        only defined on a data frame with all numeric or complex variables

I am sure there is a really simple fix, but I am missing it and I wondered if you may have some advice. Test code from R help works prefectly, but I cant seem to recreate it

# example
>dotchart(VADeaths)
>VADeaths

      Rural Male Rural Female Urban Male Urban Female
50-54       11.7          8.7       15.4          8.4
55-59       18.1         11.7       24.3         13.6
60-64       26.9         20.3       37.0         19.3
65-69       41.0         30.9       54.6         35.1
70-74       66.0         54.3       71.1         50.0

# it works with mssing data

>test <-VADeaths
>test[2,]<- NA
>test

      Rural Male Rural Female Urban Male Urban Female
50-54       11.7          8.7       15.4          8.4
55-59         NA           NA         NA           NA
60-64       26.9         20.3       37.0         19.3
65-69       41.0         30.9       54.6         35.1
70-74       66.0         54.3       71.1         50.0

>dotchart(test)

# So i created my own test data
test<- expand.grid( Educ = c("B", "I", "A"),

                    Prof = c("L", "M","C"),
                    Blacks = NA,
                    Asian = NA,
                    Hispanic = NA,
                    Native = NA,
                    Female = NA)

rownames(test) <- with(test, paste(Educ,Prof, sep = "-")) test[2:9,3:7] <- 2
temp <- test[,3:7]
temp[1, 2:3] <-5

# I want to plot temp which looks like
>temp

    Blacks Asian Hispanic Native Female

B-L     NA     5        5     NA     NA
I-L        2     2        2      2      2
A-L       2     2        2      2      2
B-M      2     2        2      2      2
I-M       2     2        2      2      2
A-M      2     2        2      2      2
B-C      2     2        2      2      2
I-C      2     2        2      2      2
A-C      2     2        2      2      2

>dotchart(temp)

Error in Summary.data.frame(..., na.rm = na.rm) :

        only defined on a data frame with all numeric or complex variables

Everything in temp is numeric and hence I dont understand the error message. Any leads would be most helpful. thank you

Al Nerdy.



Get the new Windows Live Messenger!

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 and provide commented, minimal, self-contained, reproducible code. Received on Tue Sep 12 15:57:53 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 12 Sep 2006 - 06:30:08 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.