Skip to content

Commit

Permalink
Merge pull request #22 from habitus-eu/issue108_nbh_missing_in_daysou…
Browse files Browse the repository at this point in the history
…tput

Issue108 nbh missing in daysoutput
  • Loading branch information
vincentvanhees authored May 3, 2024
2 parents 521c939 + ba1c828 commit be3ed1a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: hbGIS
Title: Process GIS Data for Human Behaviour Research
Description: Processes GIS data merge with hbGPS pre-processed data of wearable GPS and accelerometation sensors.
Version: 0.0.1
Date: 2023-12-20
Version: 0.0.3
Date: 2024-05-03
Authors@R:
c(person(given = "Vincent",
family = "van Hees",
role = c("aut", "cre"),
email = "[email protected]"),
person("Tom", "Stewart", role = "cph", email = "[email protected]",
person("Tom", "Stewart", role = "cph", email = "[email protected]",
comment = "holds copyright over original palmsplusr code"))
License: Apache License version 2.0 | file LICENSE
Imports: dplyr, sf, readr, tidyr, stringr, palmsplusr, data.table, rlang, purrr, geosphere
Expand Down
4 changes: 1 addition & 3 deletions R/build_days.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#' @param where_field ...
#' @param whenwhat_field ...
#' @param loca Nested list with location information
#' @param participant_basis participant_basis
#'
#' @return A table summarised by day.
#'
Expand All @@ -23,8 +22,7 @@
build_days <- function(whenwhatwhere = NULL, verbose = TRUE,
where_field = NULL,
whenwhat_field = NULL,
loca = NULL,
participant_basis = NULL) {
loca = NULL) {
# Note:
# home, school, home_nbh, school_nbh (or similar) need to be present,
# because the functions that are passed on assume that they exist
Expand Down
11 changes: 7 additions & 4 deletions R/hbGIS.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ hbGIS <- function(gisdir = "",
paste0("at_", locationNames[i]),
TRUE,
NA, "", "")
} else if (locationNames[i] %in% locationNames_nbh) {
cnt = cnt + 1
}

if (locationNames[i] %in% locationNames_nbh) {
# condition that only needs to be used if table element is present
at_table = ifelse(test = locationNames[i] %in% locationNames_table == TRUE, yes = paste0("!at_", locationNames[i], " &"), no = "")
CONF[cnt, ] = c("where_field",
Expand All @@ -279,8 +282,9 @@ hbGIS <- function(gisdir = "",
" & (!vehicle)"), # removed !pedestrian & !bicycle & because unclear why these are not possible in a neighbourhood, e.g. park
TRUE,
NA, "", "")
cnt = cnt + 1
}
cnt = cnt + 1

# whenwhat_field:
#-------------------
if (!is.null(loca[[i]][[1]])) {
Expand Down Expand Up @@ -428,12 +432,11 @@ hbGIS <- function(gisdir = "",
}
if (verbose) cat("\n<<< building days...")
if (length(whenwhatwhere) > 0 & length(where_field) > 0 & length(whenwhat_field) &
all(Nlocation_objects > 0) & length(participant_basis) > 0) {
all(Nlocation_objects > 0)) {
days <- build_days(whenwhatwhere = whenwhatwhere,
where_field = where_field,
whenwhat_field = whenwhat_field,
loca = loca,
participant_basis = participant_basis,
verbose = verbose)
if (length(days) > 0) {
if (verbose) cat(paste0("\n N rows in days object: ", nrow(days)))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ hbGIS(gisdir = "D:/myproject/GIS", # path to GIS file

Note:
- GIS filenames are used as location names and at the moment the code can only handle names that are shorter than 6 characters.
- Example config file can be found [here](https://github.com/habitus-eu/hbGIS/blob/main/inst/testfiles_hbGIS/config_hbGIS.csv)
- Example config file can be found [here](https://github.com/habitus-eu/HabitusGUI/tree/main/inst/testfiles_hbGIS/config_hbGIS.csv)

## Output

Expand Down
5 changes: 5 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
\name{NEWS}
\title{News for Package \pkg{HabitusGUI}}
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\section{Changes in version 0.0.3 (GitHub-only-release date: 03-05-2024)}{
\itemize{
\item Fix missing neighbourhoud results in day output #21.
}
}
\section{Changes in version 0.0.2 (GitHub-only-release date: 29-03-2024)}{
\itemize{
\item Add code comments and where needed revise object names to clarify inner workings of functions
Expand Down
5 changes: 1 addition & 4 deletions man/build_days.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit be3ed1a

Please sign in to comment.