Hi .. i am a beginner in R I have data in the format of date 04/27/11 04/27/11 04/30/11 04/30/11 05/03/11 05/03/11 05/04/11.... Now i want to plot the data something like this on x-axis... ------------------ 27 28 29 30 1 2 3 4 April May I also wanted to know how to place a "*" when a date is missing from the data.. my other question is plotting the error bars.. since you can see that i have dates repeating. how to plot the error bars for count number of dates detected... I would appreciate if someone could answer as soon as possible... thank you in advance.. -- View this message in context: http://r.789695.n4.nabble.com/plotting-date-data-over-couple-of-months-tp3666298p3666298.html Sent from the R help mailing list archive at Nabble.com.
On Jul 13, 2011, at 6:56 PM, vamshi999 wrote:> Hi .. i am a beginner in R > > I have data in the format of > > date > 04/27/11 > 04/27/11 > 04/30/11 > 04/30/11 > 05/03/11 > 05/03/11 > 05/04/11....So they are not yet dates, but rather character vectors. R dates don't look like that unless you make special efforts to mess them up.> > Now i want to plot the data something like this on x-axis... > > ------------------ > 27 28 29 30 1 2 3 4 > April May > I also wanted to know how to place a "*" when a date is missing from > the > data..If you convert to dates, then the axis function should be able to properly label a plot. Read: ?DateTimeClasses> > my other question is plotting the error bars.. since you can see > that i have > dates repeating. how to plot the error bars for count number of dates > detected...Need a better description of the data. So far you have only said you have dates. You should probably... no, make that definitely... read the Posting Guide.> > I would appreciate if someone could answer as soon as possible...Answers given to the extent possible given the limitations of the question.> > thank you in advance.. >-- David Winsemius, MD West Hartford, CT
I am sorry i was not clear in my early post.... I have used the below code to change my data into date format.. r<-as.POSIXlt(paste(data2$date,data2$time)) library(gsubfn) library(chron) r<-as.chron(r) data2$date<-strftime(strptime(r, format="(%m/%d/%y %H:%M:%S)"),"%Y-%m-%d") data2$time<-strftime(strptime(r, format="(%m/%d/%y %H:%M:%S)"),"%H:%M:%S") now i have a date variable in the below format.. "2011-04-20" while plotting dates using the above format.. i was getting the x-axis in this way.. ---------------------- 2011-04-29 2011-05-05 but i want the values in my x-axis to be in this format.. ------------------ 27 28 29 30 1 2 3 4 April May about the error plots.... i was not able to compute the mean and sd values .. My data has the following columns.. date, time, height.. this is the bird data which we recorded.. so i have date, time, height at which the birds are being detected . so now i want to plot errorbar for total no.of birds detected on each day.. for a simple plot ..i used.. counts<-table(data$date).. i was able to get the count on each day.. then.. barplot(counts).. but i was not able to calculate the mean and sd for counts.. thank you -- View this message in context: http://r.789695.n4.nabble.com/plotting-date-data-over-couple-of-months-tp3666298p3666377.html Sent from the R help mailing list archive at Nabble.com.