[R] Creating barplot using time as X

PEL pierre-etienne.lessard.1 at ulaval.ca
Wed Nov 2 20:24:29 CET 2011


Hello all,

my data looks like this:

"phaseno" / "activity"	/ "beg" / "end" / "phasetime"

1 / "L" / 2010-06-03 19:15:24 / 2010-06-03 21:18:14 / 7370
2 / "D" / 2010-06-03 21:18:15 / 2010-06-03 21:19:55 / 100
3 / "W" / 2010-06-03 21:19:56 / 2010-06-03 21:22:47 / 171
4 / "D" / 2010-06-03 21:22:48 / 2010-06-03 21:23:47 / 59
5 / "W" / 2010-06-03 21:23:48 / 2010-06-03 21:23:53 / 5
6 / "D" / 2010-06-03 21:23:54 / 2010-06-03 21:26:18 / 144
7 / "W" / 2010-06-03 21:26:19 / 2010-06-03 21:32:10 / 351
8 / "D" / 2010-06-03 21:32:11 / 2010-06-03 21:32:11 / 0
9 / "W" / 2010-06-03 21:32:12 / 2010-06-03 21:32:12 / 0
10 / "D" / 2010-06-03 21:32:13 / 2010-06-03 21:32:29 / 16

Please note that phasetime is in seconds and is only a difftime() of "beg"
and "end".

I want to create a stacked bar chart that gives me the percentage of time
spent doing every activity (L,D or W) for every 24h period. 
Example: Day 1: 20% =L; 40% = W ; 40% = D.  In a graph obviously.

What I was thinking was dividing my dataframe into several smaller
dataframes spanning 24h. I tried with by() but I doubt this is the correct
function. If possible, I would also like to separate a row the phasetime of
a row if it overlaps two 24 periods. 


I joined part of my data where *header=TRUE and sep="\t"*
http://r.789695.n4.nabble.com/file/n3981961/example.txt example.txt 

Thank you very much for your time
PEL

--
View this message in context: http://r.789695.n4.nabble.com/Creating-barplot-using-time-as-X-tp3981961p3981961.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list