[R] polygon error
peter dalgaard
pdalgd at gmail.com
Mon Apr 1 11:12:05 CEST 2013
On Apr 1, 2013, at 10:56 , catalin roibu wrote:
> Hello all!
>
> I have a problem to draw a polygon with R. My data is like this>
> Year Nb.series Perc.pos Perc.neg Nature RGV_mean RGV_sd neg poz
> 1 1901 1 0.00 0.00 0 4.29 NA 0.00 0.00
> 2 1902 1 100.00 0.00 1 16.47 NA 0.00 100.00
> 3 1903 1 100.00 0.00 1 31.31 NA 0.00 100.00
> 4 1904 1 0.00 0.00 0 -9.62 NA 0.00 0.00
> 5 1905 1 0.00 100.00 -1 -22.55 NA -100.00 0.00
> 6 1906 1 0.00 100.00 -1 -12.09 NA -100.00 0.00
> 7 1907 2 50.00 50.00 0 5.40 50.95 -50.00 50.00
> 8 1908 3 33.33 66.67 -1 -6.46 19.38 -66.67 33.33
> 9 1909 3 33.33 0.00 0 9.70 12.82 0.00 33.33
> 10 1910 3 33.33 66.67 -1 -6.91 26.42 -66.67 33.33
> 11 1911 3 0.00 66.67 -1 -11.63 13.86 -66.67 0.00
> 12 1912 3 33.33 0.00 0 16.26 29.25 0.00 33.33
> --
>
> I try this code:
> plot(seriep$Year,seriep$poz, type="l",ylim=c(-100,100))
> lines(seriep$Year,seriep$neg, type="l",col="red")
>
> polygon(c(seriep$Year,rev(seriep$Year)),c(seriep$neg,rev(seriep$poz),col="grey93",border=NA))
> and this is the error>Error in xy.coords(x, y) : 'x' and 'y' lengths differ.
>
> Please help me to solve this problem.
>
Parenthesis misplaced....
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list