[R] Polysomnographic data analysis with R?

Jim Lemon drjimlemon at gmail.com
Thu Jun 18 14:05:27 CEST 2015


Hi Charles,
As I don't know what sort of data you are using, I can only guess. If
you want to visualize the sleep patterns and events, it is fairly easy
to extract these from the sleep example on the EDF format page and
display them.

sleep_stages<-list(labels=c("Sleep stage W",
 "Sleep stage N1",
 "Sleep stage N2",
 "Sleep stage N3",
 "Sleep stage N2",
 "Sleep stage N3",
 "Sleep stage N2"),
 starts=c(0,660,960,1140,1440,1620,1890),
 ends=c(660,960,1140,1440,1620,1890,1920))
library(plotrix)
gantt.chart(sleep_stages,vgridlab=seq(0,2000,by=100),
 vgridpos=seq(0,2000,by=100),main="Sleep recording",
 taskcolors=2:5)
abline(v=c(660,742,993,1019,1526,1620,1634))
sleep_events<-c("Lights off","Turning right side -> back",
 "Limb movement R+L leg","Limb movement R leg",
 "Obstructive apnea","Obstructive apnea",
 "Turning back -> left side")
staxlab(side=1,at=c(660,742,993,1019,1526,1620,1634),
 labels=sleep_events,pos=0.555,
 top.line=1,nlines=4,cex=0.7)

Jim


On Wed, Jun 17, 2015 at 10:15 PM, Charles Novaes de Santana
<charles.santana at gmail.com> wrote:
> Dear Jim,
>
> Thank you for your response. Yes, it is the European Data Format you
> mention. Actually we can read the data correctly, but I was wondering if
> there is any package that can identify different sleep phases automatically
> based on the data. I supposed such a package does not exist, it is really
> difficult to automatize the identification of sleep phases based only on
> data, but I asked here just in case.
>
> Thanks for your attention!
>
> Best,
>
> Charles
>
> On 17 June 2015 at 13:46, Jim Lemon <drjimlemon at gmail.com> wrote:
>>
>> Hi Charles,
>> This looks like the European Data Format (EDF and EDF+), which has a
>> complete file specification. If there is no existing R package, it
>> might be possible to write an import function from the specification,
>> something like the functions in the "foreign" package.
>>
>> Jim
>>
>>
>> On Wed, Jun 17, 2015 at 4:55 AM, Charles Novaes de Santana
>> <charles.santana at gmail.com> wrote:
>> > Dear all,
>> >
>> > Do you know if there is any R package or function we can use to analyze
>> > polysomnographic data?
>> >
>> > For example, something that can import an EDF file (or in a different
>> > format) and can give some properties of the polysomnographic records
>> > like
>> > periods of different sleep phases, etc.
>> >
>> > I looked for it in the web and I didn't find. But maybe I used the wrong
>> > key-words.
>> >
>> > Any help will be much appreciated!
>> >
>> > Best,
>> >
>> > Charles
>> > --
>> > Um axé! :)
>> >
>> > --
>> > Charles Novaes de Santana, PhD
>> > http://www.imedea.uib-csic.es/~charles
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles



More information about the R-help mailing list