r-package - 如果我没有睡眠日志,如何在 R 中修改 G.Shell.GGIR 函数的第 4 部分
问题描述
我正在尝试使用 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)
解决方案
评论这部分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,
推荐阅读
- google-bigquery - bq 命令无法授权
- excel - 使用单元格值填充用户窗体文本框
- amazon-web-services - 使用 yum 在 Amazon Linux 2 中安装 .NET Core
- javascript - 网页上的 Chrome 运行时
- java - Java 碰撞摆动不能从侧面工作
- python - 如何修复命令多次不起作用
- java - How to install specific JDK (jdk1.8.0_152.jdk) on MacOS?
- r - 在正则表达式中用 \n 替换字符,然后将文本转换为 quanteda 语料库
- python-2.7 - 我可以使用 mock 来模拟单元测试中缺少的模块吗?
- flutter - Flutter 在自定义 UI 上使用 center_horizontal