我正在尝试使用R中的GGIR shell函数分析从geneactiv加速计收集的体力活动数据(代码复制自)。代码的第4部分要求将加速度计生成的睡眠数据与自报告的睡眠日志进行比较。"loglocation“参数要求您输入手动睡眠日志的CSV文件名。然而,我的研究没有包括自我报告的睡眠日志,因为我主要对身体活动水平感兴趣,而不是睡眠分析。如何修改代码以排除睡眠日志,并使代码成功运行并产生必要的可视数据?请在下面找到体力活动分析的R代码。
library(GGIR)
g.shell.GGIR(#=======================================
# INPUT NEEDED:
mode=c(1,2,3,4,5),
datadir="C:/hadiza/mydata",
outputdir="D:/myresults",
f0=1, f1=2,
#-------------------------------
# Part 1:
#-------------------------------
# Key functions: reading file, auto-calibration, and extracting features
do.enmo = TRUE, do.anglez=TRUE,
chunksize=1, printsummary=TRUE,
#-------------------------------
# Part 2:
#-------------------------------
strategy = 2, ndayswindow=7,
hrs.del.start = 0, hrs.del.end = 0,
maxdur = 9, includedaycrit = 16,
winhr = c(5,10),
qlevels = c(c(1380/1440),c(1410/1440)),
qwindow=c(0,24),
ilevels = c(seq(0,400,by=50),8000),
mvpathreshold =c(100,120),
bout.metric = 4,
closedbout=FALSE,
#-------------------------------
# Part 3:
#-------------------------------
# Key functions: Sleep detection
timethreshold= c(5), anglethreshold=5,
ignorenonwear = TRUE,
#-------------------------------
# Part 4:
#-------------------------------
# Key functions: Integrating sleep log (if available) with sleep detection
# storing day and person specific summaries of sleep
excludefirstlast = TRUE,
includenightcrit = 16,
def.noc.sleep = c(),
loglocation= "C:/mydata/sleeplog.csv",
outliers.only = TRUE,
criterror = 4,
relyonsleeplog = FALSE,
sleeplogidnum = TRUE,
colid=1,
coln1=2,
do.visual = TRUE,
nnights = 9,
#-------------------------------
# Part 5:
# Key functions: Merging physical activity with sleep analyses
#-------------------------------
threshold.lig = c(30), threshold.mod = c(100), threshold.vig = c(400),
boutcriter = 0.8, boutcriter.in = 0.9, boutcriter.lig = 0.8,
boutcriter.mvpa = 0.8, boutdur.in = c(1,10,30), boutdur.lig = c(1,10),
boutdur.mvpa = c(1), timewindow = c("WW"),
#-----------------------------------
# Report generation
#-------------------------------
# Key functions: Generating reports based on meta-data
do.report=c(2,4,5),
visualreport=TRUE, dofirstpage = TRUE,
viewingwindow=1)
发布于 2019-01-26 00:18:16
评论这部分loglocation= "C:/mydata/sleeplog.csv"
对我来说很有用。
#-------------------------------
# Part 4:
#-------------------------------
# Key functions: Integrating sleep log (if available) with sleep detection
# storing day and person specific summaries of sleep
excludefirstlast = TRUE,
includenightcrit = 16,
def.noc.sleep = c(),
#loglocation= "C:/mydata/sleeplog.csv",
outliers.only = TRUE,
criterror = 4,
relyonsleeplog = FALSE,
sleeplogidnum = TRUE,
colid=1,
coln1=2,
do.visual = TRUE,
nnights = 9,
这与此视频https://youtu.be/S8YPTrYNWdU?t=219中显示的解决方案相同
https://stackoverflow.com/questions/52560985
复制相似问题