Skip to content

Commit 9545404

Browse files
committed
End of day
1 parent d8103ab commit 9545404

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

DESCRIPTION

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Authors@R:
66
Description: This is a stub package that shows how to link to and import
77
from RcppTskit package, which provides R access to tskit C API.
88
License: MIT + file LICENSE
9-
Imports:
10-
RcppTskit
119
LinkingTo:
1210
RcppTskit
1311
Remotes:

notes.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
library(usethis)
2+
path <- "."
3+
create_package(path)
4+
proj_activate(path)
5+
use_mit_license("Gregor Gorjanc")
6+
7+
# Add to DESCRIPTION next two lines:
8+
# Imports: RcppTskit
9+
# LinkingTo: RcppTskit
10+
# And until RcppTskit is on CRAN, add to DESCRIPTION also this line:
11+
# Remotes: git::git@bitbucket.org:HighlanderLab/RcppTskit.git
12+
13+
use_tidy_description()
14+
15+
use_readme_md()
16+
17+
use_test("my-test")
18+
19+
use_git()
20+
21+
22+
Imports: Rcpp, RcppTskit
23+
LinkingTo: Rcpp, RcppTskit

src/Makevars.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PKG_LIB = @RCPPTSKIT_LIB@

src/test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <tskit.h>
2+
// [[Rcpp::depends(RcppTskit)]]
3+
// [[Rcpp::plugins(RcppTskit)]]
4+
5+
//' @title Get number of individuals in tree sequence
6+
//' @param ts an external pointer to a \code{tsk_treeseq_t} object.
7+
//' @return integer number of individuals.
8+
//' @examples
9+
//' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
10+
//' ts <- RcppTskit::ts_load(ts_file)
11+
//' RcppTskit::ts$num_individuals()
12+
//' ts_num_individuals_ptr2(ts$pointer)
13+
//' @export
14+
// [[Rcpp::export]]
15+
int ts_num_individuals_ptr2(const SEXP ts) {
16+
RcppTskit_treeseq_xptr ts_xptr(ts);
17+
return static_cast<int>(tsk_treeseq_get_num_individuals(ts_xptr));
18+
}

0 commit comments

Comments
 (0)