[R] drawing a ... barplot (?) along time

Dagmar Ramgad82 at gmx.net
Tue Dec 6 11:28:32 CET 2016


# Dear all,
# I hope someone can help me with this, I am kind of desperated even 
though it doesn't sound tooooo complicated at all. Let's see:
# I have a data frame like this:
datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"),
                        changepoint =as.POSIXct 
(strptime(as.character("03.01.2011","05.01.2011", "27.01.2011", 
"26.01.2011","28.01.2011", "28.02.2011"), "%d.%m.%Y")),
                        knownstate =c("breeding",NA, 
NA,"breeding","moulting",NA))
datframe
str(datframe)
# Now I want a stacked horizontal bar diagram: One bar-line for animal 
Kati and bellow one for animal Leon.
# Each bar should be "drawn" along the time (on the x-axes) and be 
interupted (by a vertical line) at the changepoints
# then additionally I want colours for the known states (e.g. red for 
the time from 03.01.2011 to 05.01.2011 when animal Kati was breeding)

# help would be much appreciated!



More information about the R-help mailing list