KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using R to plot some data. Date <- c("07/12/2012 05:00:00", "07/12/2012 06:00:00", "07/12/2012 07:00:00", "07/12/2012 08:00:00","07/12/2012 10:00:00","07/12/2012 11:00:00") Date <- strptime(Date, "%d/%m/%Y %H:%M") Counts <- c("0","3","10","6","5","4") Counts <- as.numeric(Counts) df1 <- data.frame(Date,Counts,stringsAsFactors = FALSE) library(ggplot2) g = ggplot(df1, aes(x=Date, y=Counts)) + geom_line(aes(group = 1)) g How do I ask R not to plot data as a continuous line when there is a break in time? I normally have a data point every hour, but sometimes there is a break (between 8 am and 10 am). Between these points, I don't want the line to connect. Is this possible in R? Edit Many thanks for the responses here. My data is now in 10 second intervals, and I wish to do the same piece of analysis using this data. df <- structure(list(Date = c("11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012", "11/12/2012"), Time = c("20:16:00", "20:16:10", "20:16:20", "20:16:30", "20:16:40", "20:16:50", "20:43:30", "20:43:40", "20:43:50", "20:44:00", "20:44:10"), Axis1 = c(181L, 14L, 65L, 79L, 137L, 104L, 7L, 0L, 0L, 14L, 0L), Steps = c(13L, 1L, 6L, 3L, 8L, 4L, 1L, 0L, 0L, 0L, 0L)), .Names = c("Date", "Time", "Axis1", "S
Tags (comma-separated)
Save Edits
Cancel