-
Notifications
You must be signed in to change notification settings - Fork 22
Time bug fix #165
Time bug fix #165
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ Makefile | |
.travis.yml | ||
appveyor.yml | ||
paper.md | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ vignettes/*.pdf | |
|
||
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 | ||
*.httr-oauth | ||
.Rproj.user | ||
*.Rproj | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You wouldn't normally add these to the git repo either. There is a tendency to put IDE / editor specific ignore stuff in your system gitignore to prevent it from getting too crazy. That said, this has the same, you probably wouldn't add it to a PR as it isn't relevant property as above. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -452,9 +452,17 @@ getEpisodePeriod <- function (e, unit="hours") { | |
# The failure of POSIX conversion indicates that this episode is either | ||
# anonymised or has a missing or incorrect value of discharge or admission | ||
# time. | ||
if (is.na(tadm) || is.na(tdisc)) | ||
period_length <- findMaxTime(e) | ||
else { | ||
if (is.na(tdisc)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tadm can probably be NA in general. It is only a specific property of the dataset you have that it cannot. |
||
if (is.null(findMaxTime(e))) { | ||
period_length <- 0 | ||
} else { | ||
period_length <- ceiling( | ||
as.numeric( | ||
difftime( | ||
as.POSIXct.numeric(findMaxTime(e), origin = "1970-01-01 00:00:00"), tadm, units = unit) | ||
)) | ||
} | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you finding max time twice? |
||
if (any(is.null(tdisc), is.null(tadm))) | ||
period_length <- NULL | ||
else | ||
|
@@ -466,6 +474,8 @@ getEpisodePeriod <- function (e, unit="hours") { | |
if (period_length == 0) | ||
period_length <- period_length + 1 | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you adding two blank lines here? What are they for? |
||
|
||
if (is.null(period_length)) | ||
warning("This episode does not have any time series data: ", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to add these to the PR. It should just be the things needed to fix the issue you are worried about.