[R] Plotting in R
Jim Lemon
drj|m|emon @end|ng |rom gm@||@com
Sun Jul 7 08:59:20 CEST 2019
Hi Steven,
A basic plot can be displayed like this:
sydf<-read.table(text="year rate
1993 0.608
1994 0.622
1996 0.623
1998 0.647
2000 0.646
2002 0.625
2004 0.628
2006 0.685
2008 0.679
2010 0.595
2012 0.567
2014 0.599
2016 0.642
2018 0.685",
header=TRUE)
plot(sydf$year,sydf$rate,type="b",
xlab="Year",ylab="Rate")
When you add more years and rates to the data frame, the axes will
change to include the years and rates outside the ones in your
example. As some have noted, this is a very basic question.
Jim
On Sat, Jul 6, 2019 at 11:33 PM Steven Yen <styen using ntu.edu.tw> wrote:
>
> I have a data frame containing two variables: year and rate (shown below).
> Which function can I use to plot rate (y-axis) against year (x-axis)?
> There will be more columns of rate later on.
> Thank you.
>
> year rate 1 1993 0.608 2 1994 0.622 3 1996 0.623 4 1998 0.647 5 2000
> 0.646 6 2002 0.625 7 2004 0.628 8 2006 0.685 9 2008 0.679 10 2010 0.595
> 11 2012 0.567 12 2014 0.599 13 2016 0.642 14 2018 0.685
>
>
> --
> styen using ntu.edu.tw (S.T. Yen)
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list