Error in rename.default(x, .base_to_ggplot) : object '.data' not found -- ???????

33 views
Skip to first unread message

dzroth

unread,
Aug 18, 2009, 7:41:27 PM8/18/09
to ggplot2
Hello,

I'm new to ggplot2, but from what i've seen, it looks like a great
program. However I'm having some difficulties using the package. I'm
attempting to create a bar plot showing the number of individuals in
each species across a series of sites. However, no matter how I
attempt to set up the script, I get the following error message.


"Error in rename.default(x, .base_to_ggplot) : object '.data' not
found"

This error message appears to be popping up even on scripts which
successfully produced nice figures yesterday. I'm guessing it has to
do with my data structure (see below), but I can't for the life of me
figure it out.

Any information anyone may have would be greatly appreciated.

Thanks,

Dave




Data:

X Trap Species Number
1 1 1 Aedes (Ochlerotatus) species 26
2 2 2 Aedes (Ochlerotatus) species 29
3 3 3 Aedes (Ochlerotatus) species 1345
4 4 4 Aedes (Ochlerotatus) species 1355
5 5 5 Aedes (Ochlerotatus) species 383
6 6 6 Aedes (Ochlerotatus) species 115
7 7 7 Aedes (Ochlerotatus) species 16
8 8 8 Aedes (Ochlerotatus) species 20
19 19 1 Anopheles species 11
20 20 2 Anopheles species 5
21 21 3 Anopheles species 10
22 22 4 Anopheles species 11
23 23 5 Anopheles species 32
24 24 6 Anopheles species 25
25 25 7 Anopheles species 10
26 26 8 Anopheles species 1
35 35 1 Coquilletidia perturbans 5
36 36 2 Coquilletidia perturbans 8
37 37 3 Coquilletidia perturbans 2
38 38 4 Coquilletidia perturbans 10
39 39 5 Coquilletidia perturbans 13
40 40 6 Coquilletidia perturbans 2
41 41 7 Coquilletidia perturbans 1
51 51 1 Culex pipiens 39
52 52 2 Culex pipiens 46
53 53 3 Culex pipiens 1
54 54 4 Culex pipiens 8
55 55 5 Culex pipiens 4
56 56 6 Culex pipiens 3
57 57 7 Culex pipiens 6
58 58 8 Culex pipiens 2
65 65 1 Culex tarsalis 440
66 66 2 Culex tarsalis 397
67 67 3 Culex tarsalis 85
68 68 4 Culex tarsalis 426
69 69 5 Culex tarsalis 127
70 70 6 Culex tarsalis 158
71 71 7 Culex tarsalis 19
72 72 8 Culex tarsalis 38
83 83 1 Culiseta species 11
84 84 2 Culiseta species 6
85 85 3 Culiseta species 76
86 86 4 Culiseta species 53
87 87 5 Culiseta species 55
88 88 6 Culiseta species 44

Luciano Selzer

unread,
Aug 18, 2009, 9:02:36 PM8/18/09
to dzroth, ggplot2
Hi Dave, I don't know what your problem is as I don't know what code are you using. However I have no problems using this code, I'm assuming the traps number are the locations


#mosquitos is the data you supplied
library(ggplot2)
qplot(Species, Number, data = mosquitos, fill = as.factor(Trap), geom = 'bar', position = 'dodge' )
#The graph doesn't look well as the labels of the species overlap, so we add this
last_plot() + opts ( axis.text.x = theme_text (angle = 45, vjust = 1 , hjust = 1 ) )
#if you want the location on the x axis the code is
qplot(as.factor(Trap), Number, data = mosquitos, fill = Species, geom = 'bar', position = 'dodge' )
#if you just want the stacked bars, then remove the "position = 'dodge'" bit
qplot(as.factor(Trap), Number, data = mosquitos, fill = Species, geom = 'bar'


I hope that's what you wanted

Bye and good luck with the code


2009/8/18 dzroth <dzr...@gmail.com>



--
Luciano
Reply all
Reply to author
Forward
0 new messages