Skip to content

Commit

Permalink
Convert tskit results from arrays to standard R numeric vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
bodkan committed Sep 16, 2022
1 parent d362800 commit 5101b39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

- Deprecated argument `sampling = ` of the functions `slim()` and `msprime()` has now been permanently removed in favour of the `samples =` argument ([#6bfda57](https://github.com/bodkan/slendr/commit/6bfda57)).

- Avoid the unnecessary `array` type of _tskit_ results returned via reticulate. Numeric vectors (columns of data frames with numerical results) obtained in this way are simple R numeric vector ([#c690334](https://github.com/bodkan/slendr/commit/c690334)).

# slendr 0.3.0

- SLiM 4.0 is now required for running simulations with the `slim()` engine. If you want to run _slendr_ simulations with SLiM (spatial or non-spatial), you will need to upgrade you SLiM installation. SLiM 3.7.1 version is no longer supported as the upcoming new _slendr_ spatial features will depend on SLiM 4.x and maintaining two functionally identical yet syntactically different back ends is not feasible (PR [#104](https://github.com/bodkan/slendr/pull/104)).
Expand Down
4 changes: 2 additions & 2 deletions R/tree-sequences.R
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ multiway_stat <- function(ts, stat = c("fst", "divergence"),
as.data.frame(t(matrix(set)), stringsAsFactors = FALSE)
}) %>%
dplyr::as_tibble() %>%
dplyr::mutate(stat = values)
dplyr::mutate(stat = as.numeric(values))

result
}
Expand Down Expand Up @@ -1794,7 +1794,7 @@ oneway_stat <- function(ts, stat, sample_sets, mode, windows, span_normalise = N
set_names <- names(sample_sets)

result <- dplyr::tibble(set = set_names)
result[[stat]] <- values
result[[stat]] <- as.numeric(values)
result
}

Expand Down

0 comments on commit 5101b39

Please sign in to comment.