Skip to content

Latest commit

 

History

History

Rcpp

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

How to use vcfpp in R

Build R package

There is a R package https://github.com/Zilong-Li/vcfppR demonstrates how to build your own R package with vcfpp. Here are the important steps:

Write R scripts

If you don’t want to build a R package, then you just need to install vcfpp.h and htslib in your system environment. For example, assume you have a conda environment ~/mambaforge/envs/R, the system environment are ~/mambaforge/envs/R/include for header files and ~/mambaforge/envs/R/lib for library files. Then you can compile and run functions from the Rcpp_example.cpp file in R by

library(Rcpp)
## setup library path if they are not in the system env
Sys.setenv("PKG_LIBS"="-I~/mambaforge/envs/R/include -L~/mambaforge/envs/R/include -lhts")
sourceCpp("Rcpp_example.cpp", verbose=TRUE, rebuild=TRUE)