[R] R - PLOT - X-AXIS - DECIMALS

statup r statup.r at gmail.com
Thu Nov 20 07:33:18 CET 2014


this got fixed when I added 3 more rows to my existing test.csv file, i.e.
new file got below data, with additional 3 rows:

   year   sale
    2001  100
    2002  200
    2003  300
    2004  400
    2005  500

What's the secret behind 5 rows , i mean is there any link between plot
chart and 5 values ?
If I use less than 5 rows, it's breaking x-axis values into 5 decimals !!!

Hope you understood what I've told, if not, let me know...will provide you
reproducible steps.

Many Thanks.





On Thu, Nov 20, 2014 at 2:55 AM, MacQueen, Don <macqueen1 at llnl.gov> wrote:

> My guess is that perhaps
>   plot(aaa$year, aaa$sale)
> will produce something closer to what was expected.
>
> --
> Don MacQueen
>
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
>
>
>
>
>
> On 11/19/14, 8:26 AM, "Sarah Goslee" <sarah.goslee at gmail.com> wrote:
>
> >Hi,
> >
> >Since you didn't provide a reproducible example, we have no way of
> >knowing.
> >
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproduci
> >ble-example
> >
> >But if I were you, I'd start with
> >str(aaa)
> >because my first guess is that your data import did not work as you
> >expected.
> >
> >
> >
> >On Wed, Nov 19, 2014 at 10:13 AM, statup r <statup.r at gmail.com> wrote:
> >> I have a test.csv with two fields "year" and "sale", with below values:
> >>
> >> year   sale
> >> 2001    1002002    200
> >
> >That looks like three fields to me.
> >This may be an example of why you SHOULDN'T post to the list in HTML.
> >
> >
> >> This is what I did in R.
> >>
> >>>aaa<-read.csv("test.csv")
> >>
> >>>plot(aaa)
> >>
> >>
> >> But when I call the above plot function why I'm getting decimals in
> >>x-axis
> >> (year) ex: 2001.0, 2002.05
> >>
> >> Please help.
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >
> >--
> >Sarah Goslee
> >http://www.functionaldiversity.org
> >
> >______________________________________________
> >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.
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list