12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating line chartsTo create a line chart, you use the geom_line() function. You use this functionin a very similar way to geom_point(), with the difference that geom_line() draws aline between consecutive points in your data.This type of chart is useful for time series data in data frames, such as thepopulation data in the built-in dataset longley (see Chapter 17). To create a linechart of unemployment figures, you use the following:> ggplot(longley, aes(x=Year, y=Unemployed)) + geom_line()This creates Figure 18-4.Figure 18-4: Drawing a line chart with geom_line().You can use either geom_line() or geom_path() to create a line drawing inggplot2. The difference is that geom_line() first orders the observations

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!