Make your years numeric, not character.
Then
plot(Year, AnnualInflation, type='l')
(don't need the data frame for this plot)
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 3/14/14 11:15 AM, "Miguel A. Buitrago" <miguelabuitrago at
gmail.com>
wrote:
>Dear R-helpers,
>
>here is a novice question. I want to plot a two variable graph: year and
>Inflation Rate.
>
>I created two vectors which I combined into a data frame:
>
>Year <- c("1990", "1991", "1992",
"1993", "1994", "1995", "1996",
"1997",
>"1998", "1999", "2000", "2001",
"2002", "2003", "2004", "2005",
"2006",
>"2007", "2008", "2009", "2010",
"2011", "2012")
>AnnualInflation <- c(17.12, 21.44, 12.06, 8.53, 7.88, 10.19, 12.43, 4.71,
>7.67, 2.16, 4.60, 1.60, 0.92, 3.34, 4.44, 5.40, 4.28, 8.70, 14.01, 3.35,
>2.50, 9.88, 4.52)
>
>Data <- data.frame(Year, AnnualInflation)
>
>then plotted like this:
>
>plot(Data, main = "Annual Inflation Rate for Bolivia - 1990 to
2012", xlab
>= "Year", ylab = "Annual Inflation Rate", type =
"l")
>
>However, the graph shows the data points with dashes, and I would like to
>connect them with a line.
>
>Thank you.
>
>-------------------------------
>
>Dr. Miguel A. Buitrago
>Associate Researcher, GIGA Institute of Latin American Studies
>Adjunct Lecturer, University of Hamburg
>
>GIGA German Institute of Global and Area Studies
>Neuer Jungfernstieg 21, 20354 Hamburg, Germany
>Office: 735
>Tel.: +49 40 42825 539
>Email: miguelabuitrago at gmail.com
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.