[R] Help in debugging a script

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Mon Jul 16 12:00:33 CEST 2018


Hi Frederic,
You are asking for the sum of cases in the months September to
December for the years 2012 to 2017. I get a plot that shows that
from:

plot(busoro[,"X"],busoro[,"Sep"] + busoro[,"Oct"] + busoro [,"Nov"] +
busoro[,"Dec"],type="b",ylab="Malaria Cases",xlab="Year")

What sort of plot were you expecting?

Jim

On Mon, Jul 16, 2018 at 4:42 PM, Frederic Ntirenganya <ntfredo using gmail.com> wrote:
> Dear Friends,
>
> I would like to ask for help.
> I am plotting monthly data as seasonal by adding particular months but I am
> getting an unexpected graph. What I want is why and what can be another
> alternative?
>
> Here is the data and R script
>
> busoro <- read.csv("G:/Fredo/PAPER/Malaria climate paper/data/NYANZA
> DATA/busoro2.csv", header=T)
>
> # x axis
> y = 2012:2017
> #plot
> plot(y,busoro[,"Sep"] + busoro[,"Oct"] + busoro [,"Nov"] +
> busoro[,"Dec"],type="b",
>      ylab="Malaria Cases",xlab="Year")
>
> grid(10,10,lwd=2)
>
> dput((head(busoro)))structure(list(X = 2012:2017, Jan = c(73L, 754L,
> 1016L, 2651L,
> 1201L, 3405L), Feb = c(129L, 959L, 1276L, 3917L, 1262L, 3715L
> ), Mar = c(238L, 770L, 1670L, 3975L, 1379L, 3571L), Apr = c(705L,
> 875L, 1117L, 3549L, 1021L, 2789L), May = c(915L, 1034L, 1379L,
> 3092L, 2091L, 3487L), Jun = c(985L, 741L, 1612L, 4351L, 1599L,
> 1662L), Jul = c(402L, 115L, 901L, 3394L, 623L, 817L), Aug = c(337L,
> 218L, 966L, 1002L, 732L, 755L), Sep = c(353L, 580L, 2284L, 2427L,
> 2033L, 1134L), Oct = c(1016L, 1243L, 2788L, 3571L, 2940L, 1763L
> ), Nov = c(682L, 1336L, 2229L, 2730L, 2866L, 1469L), Dec = c(641L,
> 1049L, 1701L, 1380L, 2153L, 1321L)), .Names = c("X", "Jan", "Feb",
> "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
> "Dec"), row.names = c(NA, 6L), class = "data.frame")
>
>
> Thanks in advance.
>
>
> Frederic Ntirenganya
> Nyanza District,
> Data Mnager.
> Mobile:(+250)788757619
> Email: fredo using aims.ac.za
> https://sites.google.com/a/aims.ac.za/fredo/
>
>         [[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