Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Mar 25, 2024
1 parent bfd86f2 commit a7e91f3
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/JointModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ JointModel <- function(
)
)

base_model <- paste0(read_stan("base/base.stan"), collapse = "\n")
base_model <- read_stan("base/base.stan")

stan_full <- decorated_render(
.x = base_model,
Expand Down
2 changes: 1 addition & 1 deletion R/Link.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ as.StanModule.Link <- function(object, ...) {

base_stan <- StanModule(
decorated_render(
.x = paste(read_stan("base/link.stan"), collapse = "\n"),
.x = read_stan("base/link.stan"),
items = as.list(keys)
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/LongitudinalGSF.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ LongitudinalGSF <- function(
) {

gsf_model <- StanModule(decorated_render(
.x = paste0(read_stan("lm-gsf/model.stan"), collapse = "\n"),
.x = read_stan("lm-gsf/model.stan"),
centred = centred
))

Expand Down
5 changes: 1 addition & 4 deletions R/LongitudinalModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ LongitudinalModel <- function(
...
) {

base_stan <- paste0(
read_stan("base/longitudinal.stan"),
collapse = "\n"
)
base_stan <- read_stan("base/longitudinal.stan")

stan_full <- decorated_render(
.x = base_stan,
Expand Down
2 changes: 1 addition & 1 deletion R/LongitudinalSteinFojo.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ LongitudinalSteinFojo <- function(
) {

sf_model <- StanModule(decorated_render(
.x = paste0(read_stan("lm-stein-fojo/model.stan"), collapse = "\n"),
.x = read_stan("lm-stein-fojo/model.stan"),
centred = centred
))

Expand Down
4 changes: 2 additions & 2 deletions R/StanModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ as.list.StanModule <- function(x, stan_blocks = STAN_BLOCKS, ...) {
#' @param filename (`string`)\cr file name.
#'
#' @keywords internal
is_file <- function(filename = NULL) {
if (is.null(filename)) {
is_file <- function(filename = NULL) { if (is.null(filename)) {

Check warning on line 240 in R/StanModule.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/StanModule.R,line=240,col=38,[brace_linter] Opening curly braces should never go on their own line and should always be followed by a new line.
return(FALSE)

Check warning on line 241 in R/StanModule.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/StanModule.R,line=241,col=8,[indentation_linter] Indentation should be 4 spaces but is 8 spaces.
}
assert_that(
Expand All @@ -262,6 +261,7 @@ is_file <- function(filename = NULL) {
#' @param string Character, either the absolute path of a stan file, or the name of the stan
#' file in the package directory or the stan code as a string.
read_stan <- function(string) {
string <- paste0(string, collapse = "\n")
local_inst_file <- file.path("inst", "stan", string)
system_file <- system.file(file.path("stan", string), package = "jmpost")
local_file <- string
Expand Down
2 changes: 1 addition & 1 deletion R/SurvivalModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SurvivalModel <- function(
name = "<Unnamed>",
...
) {
base_stan <- paste0(read_stan("base/survival.stan"), collapse = "\n")
base_stan <- read_stan("base/survival.stan")
stan_full <- decorated_render(
.x = base_stan,
stan = add_missing_stan_blocks(as.list(stan))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-LongitudinalQuantiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ test_that("LongitudinalQuantities can recover known results", {
})


test_that("LongitudinalQuantities correctly subsets patients and rebuilds correct value for each smaple", {
test_that("LongitudinalQuantities correctly subsets patients and rebuilds correct value for each sample", {
set.seed(101)
ensure_test_data_1()
times <- c(-100, 0, 1, 100, 200)
Expand Down

0 comments on commit a7e91f3

Please sign in to comment.