## Kodar,
tmp <- textConnection("Date Time ts_mean_RR ts_sdnn_RR ts_mean_HR
ts_sdnn_HR ts_rmssd
20110905 07:21:50.0 1139.8298 40.3053 52.7393 2.2824 45.7958
20110906 07:11:37.0 1182.7333 49.1861 50.8665 2.4983 60.2329
20110907 07:21:31.0 1136.6028 49.4682 52.9566 2.9231 47.6896
20110908 07:23:53.0 1133.3475 53.7714 53.1378 3.1837 54.5673
20110909 07:29:21.0 1110.3194 43.1768 54.2002 2.8508 40.4889
20110910 09:34:02.0 1041.7597 58.5150 57.9255 4.1735 53.6907
20110911 11:19:24.0 994.8509 72.9786 60.7633 5.2805 63.8904
20110912 07:03:06.0 1133.4255 37.4771 53.0426 2.1921 46.8450
20110913 07:18:43.0 1165.3796 68.6048 51.8129 3.7769 65.2377"
)
heart <- read.table(tmp, header=TRUE); close(tmp)
heart$DateTime <- as.POSIXlt(paste(as.character(heart$Date),
as.character(heart$Time)), format="%Y%m%d %H:%M:%S")
xyplot(ts_mean_RR + ts_sdnn_RR + ts_mean_HR + ts_sdnn_HR + ts_rmssd ~
DateTime,
data=heart, outer=TRUE, pch=16,
scales=list(y=list(relation="free")), layout=c(1,5))
## This handles missing days correctly. I am changing the first of your
values to August 26.
## And the fourth to 7PM
heart$DateTime[1] <- heart$DateTime[1] - 10*24*60*60
heart$DateTime[4] <- heart$DateTime[4] + 12*60*60
xyplot(ts_mean_RR + ts_sdnn_RR + ts_mean_HR + ts_sdnn_HR + ts_rmssd ~
DateTime,
data=heart, outer=TRUE, pch=16,
scales=list(y=list(relation="free")), layout=c(1,5))
## You probably should not use barcharts for this data.
## Read about time classes in these two documents
## Please see the articles
## Grothendieck & Petzoldt (2004). Date and Time Classes in R.
## R News, 4(1), 29-32.
http://www.R-project.org/doc/Rnews/<http://www.r-project.org/doc/Rnews/>
## for a good introduction.
## Also see the related JSS publication:
## Garrett Grolemund, Hadley Wickham (2011).
## Dates and Times Made Easy with lubridate.
## Journal of Statistical Software, 40(3), 1-25.
## http://www.jstatsoft.org/v40/i03/.
## Rich
On Sun, Nov 20, 2011 at 4:25 PM, kodar <darko.petrovic.85@gmail.com>
wrote:
> Hi everyone,
>
> I currently do some statistics about my heart rate variability. I've a
CSV
> file which looks like this:
>
> Date Time ts_mean_RR ts_sdnn_RR ts_mean_HR ts_sdnn_HR ts_rmssd
> 1 20110905 07:21:50.0 1139.8298 40.3053 52.7393 2.2824 45.7958
> 2 20110906 07:11:37.0 1182.7333 49.1861 50.8665 2.4983 60.2329
> 3 20110907 07:21:31.0 1136.6028 49.4682 52.9566 2.9231 47.6896
> 4 20110908 07:23:53.0 1133.3475 53.7714 53.1378 3.1837 54.5673
> 5 20110909 07:29:21.0 1110.3194 43.1768 54.2002 2.8508 40.4889
> 6 20110910 09:34:02.0 1041.7597 58.5150 57.9255 4.1735 53.6907
> 7 20110911 11:19:24.0 994.8509 72.9786 60.7633 5.2805 63.8904
> 8 20110912 07:03:06.0 1133.4255 37.4771 53.0426 2.1921 46.8450
> 9 20110913 07:18:43.0 1165.3796 68.6048 51.8129 3.7769 65.2377
>
> I'll plot one of these column as barplot with the 'Date' field
in the
> x-axis. But as some days I miss to record my heart, the days in the first
> column are not always consecutive. Therefore I'm looking for a
technique
> with which I can visually show these blank record in my barplot diagram. I
> know I can add manually these blank records directly in the CSV file but
> I'll avoid this process since the CSV file is generated automatically
and
> can be overwritten.
>
> I think I should first create an array of the days I want to plot and try
> to
> match the 'Date' column with this array. But as I'm new in R
I've no idea
> how I can do that in a R script.
>
> Anyone can put me on the right track or give me a simple example ?
>
> Thanks in advance for the help.
>
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/Inserting-blank-records-in-a-barplot-tp4089619p4089619.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]