Code was ran in RStudio ( version 0.98.1091, R 3.1.2) on a Mac running 10.10. Not enough reputation to post image so please run the R code if you can.
My issue is with the way my plots are displaying my points as points instead of bars. I have a data frame defined as below.
ebola = c(0,26,1,2,0,2,0,0)
dengue = c(474,1943,2209,963,1498,1720,1360,1364)
rabies = c(1336,1353,1938,3116,908,1264,2499,1130)
year = c("2007","2008","2009","2010","2011","2012","2013","2014")
virus_data_by_year = data.frame(year,ebola,dengue,rabies)
virus_data_by_year
The above functions work fine. My problem comes when I try to plot let's say year vs. ebola with the following function:
with(virus_data_by_year,plot(year,ebola,type="p",xlab="year",ylab="ebola"))
Even though I use the point element in my type argument it shows

My issue with the above plot is that it shows my data as horizontal bars instead of as points. When I change the type argument to a line it still displays the same graph instead of having points connected by a line like below.
plot (year,ebola, type = "b")

I can graph it perfectly fine if I graph the original two vectors so this seem to be a data frame issue. Furthermore it's limited to the year one because if I use the function below it still plots a line graph fine.
with(virus_data_by_year,plot(ebola,dengue,type = "b"))
Convert year to valid date format, year = as.Date(year, "%Y").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With