Skip to content

help with making figures

5 messages · Bert Gunter, Jean V Adams, megalops +1 more

#
I need to make about 30 figures and I am trying to create a program in R that
will make my life a lot easier.  First I will tell you how my data is setup. 
I have 30 sites and then data for each year at the site.  I have 10 years of
data for each site.   Below is a small chunk of my data to show the format.    
2000	2001	2002	2003	2004
Site A	50	75	25	55	60
Site B	58	22	68	77	30

I am trying to write a program in R that will create figures showing the
annual data for each individual site.  As opposed to making 30 individual
graphs in Excel.  Any help would be greatly appreciated.  




--
View this message in context: http://r.789695.n4.nabble.com/help-with-making-figures-tp4645074.html
Sent from the R help mailing list archive at Nabble.com.
#
First convert your data from short fat to long thin format: Column
headings  for the transformed data frame are:

Year     Site     Result

This can be done in a variety of ways, but check out the reshape2
package or the reshape function ins the stats package.

Once you have the data in this form, , say in the data frame, mydat,
you can plot the series by sites in a trellised layout. Either the
lattice or ggplot2 package can do this easily. e.g. in lattice it is:

xyplot(Result ~Year|Site, data = mydat, type = "b")

You can adjust the layout etc. to your taste.

There's lots more you can do, depending on what is important to you,
but that should get you started.

Cheers,
Bert
On Thu, Oct 4, 2012 at 1:01 PM, megalops <megalops31 at hotmail.com> wrote:

  
    
#
On 05.10.2012 21:59, megalops wrote:
Megalops31,

which suggestion? You failed to quote former messages!

I don't understand how I can
What is an xypot example?
Please read the posting guide for this *mailing list*.

Uwe Ligges