[R-sig-eco] R graphics cookbook

2013-09-23 Thread Dylann Kersusan
Hi everyone,

I am trying to apply the following lines of coding (they are from the R
Graphics Cookbook, Chapter 3: Bar Graphs):

ggplot(data, aes(x=year_bis,y=area)) + geom_bar(stat=identity)

I do have a data.frame as follow:

  id year start_day locarea
1  1 2010   155  20  3.4388
2  1 2010   169  18 11.6576
3  1 2010   183  17 15.5893
4  1 201071  41 22.0356
5  1 2010   127  42 27.2602
6  1 201099  37 52.2779


 str(data)'data.frame':221 obs. of  5 variables:
 $ id   : int  1 1 1 1 1 1 1 1 1 1 ...
 $ year : int  2010 2010 2010 2010 2010 2010 2008 2010 2009 2010 ...
 $ start_day: int  155 169 183 71 127 99 337 1 337 113 ...
 $ loc  : int  20 18 17 41 42 37 10 36 41 40 ...
 $ area : num  3.44 11.66 15.59 22.04 27.26 ...


I called both packages gcookbook and ggplot2 (among others). That's a
rather easy line of coding, but for some reasons I do have the following
warning message:

Error in as.environment(x) :

incorrect

objet for 'as.environment'


Do you have any clue why?
Thanks a lot.

Greetings.
-- 
Dylann Kersusan
Master Biodiversity and Conservation
Zoology dept. Stockholm University
--
Grimsö Wildlife Research Center
Ecology dept. SLU
Riddarhyttan-Sweden

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] R graphics cookbook

2013-09-23 Thread Roman Luštrik
I see `area` in your data.frame, but where's `year_bis`?

Cheers,
Roman


On Mon, Sep 23, 2013 at 9:36 AM, Dylann Kersusan
kersusan.dyl...@gmail.comwrote:

 Hi everyone,

 I am trying to apply the following lines of coding (they are from the R
 Graphics Cookbook, Chapter 3: Bar Graphs):

 ggplot(data, aes(x=year_bis,y=area)) + geom_bar(stat=identity)

 I do have a data.frame as follow:

   id year start_day locarea
 1  1 2010   155  20  3.4388
 2  1 2010   169  18 11.6576
 3  1 2010   183  17 15.5893
 4  1 201071  41 22.0356
 5  1 2010   127  42 27.2602
 6  1 201099  37 52.2779


  str(data)'data.frame':221 obs. of  5 variables:
  $ id   : int  1 1 1 1 1 1 1 1 1 1 ...
  $ year : int  2010 2010 2010 2010 2010 2010 2008 2010 2009 2010 ...
  $ start_day: int  155 169 183 71 127 99 337 1 337 113 ...
  $ loc  : int  20 18 17 41 42 37 10 36 41 40 ...
  $ area : num  3.44 11.66 15.59 22.04 27.26 ...


 I called both packages gcookbook and ggplot2 (among others). That's a
 rather easy line of coding, but for some reasons I do have the following
 warning message:

 Error in as.environment(x) :

 incorrect

 objet for 'as.environment'


 Do you have any clue why?
 Thanks a lot.

 Greetings.
 --
 Dylann Kersusan
 Master Biodiversity and Conservation
 Zoology dept. Stockholm University
 --
 Grimsö Wildlife Research Center
 Ecology dept. SLU
 Riddarhyttan-Sweden

 [[alternative HTML version deleted]]


 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology




-- 
In God we trust, all others bring data.

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] R graphics cookbook

2013-09-23 Thread Jeremy Chacon
Hello,

you've probably already figured it out, but the error is because you are
telling ggplot to use an x variable which doesn't exist:

ggplot(data, aes(x=year_bis,y=area)) + geom_bar(stat=identity

year_bis is not a column in the data frame you show us, if you change it to:

ggplot(data, aes(x=year,y=area)) + geom_bar(stat=identity)

it should work.

Date: Mon, 23 Sep 2013 09:36:09 +0200
 From: Dylann Kersusan kersusan.dyl...@gmail.com
 To: r-sig-ecology@r-project.org
 Subject: [R-sig-eco] R graphics cookbook
 Message-ID:
 CAEcqiB9vGNNO=s_xTer=xsWaqAsw=
 ctbhqgsxd2esmevzaj...@mail.gmail.com
 Content-Type: text/plain

 Hi everyone,

 I am trying to apply the following lines of coding (they are from the R
 Graphics Cookbook, Chapter 3: Bar Graphs):

 ggplot(data, aes(x=year_bis,y=area)) + geom_bar(stat=identity)

 I do have a data.frame as follow:

   id year start_day locarea
 1  1 2010   155  20  3.4388
 2  1 2010   169  18 11.6576
 3  1 2010   183  17 15.5893
 4  1 201071  41 22.0356
 5  1 2010   127  42 27.2602
 6  1 201099  37 52.2779


  str(data)'data.frame':221 obs. of  5 variables:
  $ id   : int  1 1 1 1 1 1 1 1 1 1 ...
  $ year : int  2010 2010 2010 2010 2010 2010 2008 2010 2009 2010 ...
  $ start_day: int  155 169 183 71 127 99 337 1 337 113 ...
  $ loc  : int  20 18 17 41 42 37 10 36 41 40 ...
  $ area : num  3.44 11.66 15.59 22.04 27.26 ...


 I called both packages gcookbook and ggplot2 (among others). That's a
 rather easy line of coding, but for some reasons I do have the following
 warning message:

 Error in as.environment(x) :

 incorrect

 objet for 'as.environment'


 Do you have any clue why?
 Thanks a lot.

 Greetings.
 --
 Dylann Kersusan
 Master Biodiversity and Conservation
 Zoology dept. Stockholm University
 --
 Grimsö Wildlife Research Center
 Ecology dept. SLU
 Riddarhyttan-Sweden

 [[alternative HTML version deleted]]



 --

 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


 End of R-sig-ecology Digest, Vol 66, Issue 11
 *




-- 
*
___

Jeremy M. Chacon, Ph.D.*
*
*
*Post-Doctoral Associate, Gardner Lab*
*University of Minnesota*
*Genetics, Cell Biology, and Development*
*6-160 Jackson Hall*
*321 Church St. SE*
*Minneapolis, MN 55455*
*USA*
*
*
*chaco...@umn.edu*
*Lab telephone: **612-626-6906*

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology