Error in qplot: object "SUM_GB" not found

9 views
Skip to first unread message

Timothy Bates

unread,
Mar 16, 2009, 11:56:22 PM3/16/09
to ggp...@googlegroups.com
anyone have a suggestion as to why 

qplot(SUM_GB, data=sli, geom="histogram")

fails with error "Error in qplot(SUM_GB, data = sli, geom = "histogram") : 
  object "SUM_GB" not found"

while this works?

hist(sli$SUM_GB)

i.e., SUM_GB is a valid column in an existing dataset sli, but qplot can't find it?

t

Wayne Folta

unread,
Mar 17, 2009, 8:24:16 AM3/17/09
to Timothy Bates, ggp...@googlegroups.com
I did:

sli <- data.frame (SUM_GB=c(1, 2, 3, 4, 5, 2, 3, 1, 3, 3, 2, 4, 1, 1, 1, 1, 1, 1, 1))
qplot (SUM_GB, data=sli, geom="histogram", binwidth=1)

and it works for me... Perhaps if you showed a small sample of creating sli? Otherwise, we're left guessing about possible issues with sli's creation and content.

   Wayne

Timothy Bates

unread,
Mar 17, 2009, 11:22:38 PM3/17/09
to Wayne Folta, ggp...@googlegroups.com
There are over 200 columns in this dataframe. I wonder if that is the issue?

hadley wickham

unread,
Mar 18, 2009, 9:15:00 AM3/18/09
to Timothy Bates, Wayne Folta, ggp...@googlegroups.com
Are you sure sli is a data frame? What does str(sli) show?

Hadley
--
http://had.co.nz/

Timothy Bates

unread,
Mar 18, 2009, 9:07:09 PM3/18/09
to hadley wickham, Wayne Folta, ggp...@googlegroups.com
str gives a list like this:

'data.frame': 2529 obs. of  204 variables:
 $ ID                : int  8002001 8002002 8003001 8003002 8003301 8003302 8004001 8004002 8004050 8004101 ...
 $ SEX               : Factor w/ 2 levels "F","M": 2 1 2 2 2 1 1 2 2 1 ...
 $ DOB               : Factor w/ 1354 levels "01-01-1980","01-01-1982",..: 651 651 313 313 229 229 380 380 700 37 ...
 $ TESTDATE          : Factor w/ 225 levels "","01-02-2006",..: 85 85 85 85 85 85 151 151 151 111 ...
 $ RD001             : int  5 5 5 5 5 5 5 5 5 5 ...
 $ RD002             : int  5 5 5 5 5 5 5 5 5 5 ...
 $ RD003             : int  5 5 5 5 5 5 5 5 5 5 ...
....
 $ IRR               : num  0.88 0.9 0.76 0.85 0.9 1 0.8 0.61 0.51 0.85 ...
 $ REG               : num  0.97 0.97 0.77 0.97 1 0.95 0.87 0.85 0.9 0.97 ...
 $ NON               : num  0.73 0.93 0.53 0.8 0.88 0.95 0.65 0.55 0.65 0.8 ...
 $ SP_IRR            : num  0.56 0.56 0.17 0.44 0.61 0.78 0.39 0.33 0.17 0.56 ...
 $ SP_REG            : num  0.94 1 0.61 0.83 0.89 0.94 0.83 0.56 0.72 0.94 ...
 $ SP_REGIT          : num  0.67 0.89 0.5 0.61 0.89 0.78 0.67 0.28 0.33 0.61 ...
 $ TESTDATE.1        : Factor w/ 435 levels "","01-02-2006",..: 414 427 201 201 201 295 264 414 295 203 ...
 $ SUM_GB            : int  33 37 30 27 35 34 39 27 36 39 ...
 $ SUM_DC            : int  16 11 5 10 10 12 12 8 11 17 ...
Reply all
Reply to author
Forward
0 new messages