I have trying hard to make a r package myself. I followed the instruction in previous question in stackoverflow on how to develop package for layman. Here are the steps I tool following the previous question.
Run R code in fresh R session
# random DNA function randDNA = function(n){ paste(sample(c("A", "C", "T", "G"), n, replace = TRUE), collapse = "") } # DNA to RNA function dna2rna <- function(inputStr) { if (!is.character(inputStr)) stop("need character input") is = toupper(inputStr) chartr("T", "U", is) } # complementary sequence function compSeq <- function(inputStr){ chartr("ACTG", "TGAC", inputStr) } # example data dnaseq1 <- c("ATTGTATCTGGGTATTTCCCTTAATTGGGGCCTTT") dnaseq2 <- c("TGGGGTAAACCCGGTTTAAAATATATATATTTTT") myseqdata <- data.frame(dnaseq1, dnaseq2) save(myseqdata, file = "myseqdata.RData")
Install Rtools Install R package utils
Pefrom the following task in R
require(utils) package.skeleton(list = c("randDNA","dna2rna", "compSeq", "myseqdata"), name = "dnatool",environment = .GlobalEnv, path = "c:", force = FALSE)
Edit system environment variable path to following in windows 7
C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\MinGW\bin; C:\Program Files\R\R-2.14.2\bin\x64;
(type
>path
in command line to check if the path is properly set.Copy the folder dnatool in step (3) and put in new folder named rpackage, Now change directory to this folder (in DOS)
c: \ repackage> R CMD build dnatool c: \ repackage> Rcmd build dnatool
Edit: I am sometime getting dnatool.zip but other times dnatool.tar.gx
Checking package in command line (DOS)
c: \ repackage> R CMD check dnatool
I was able to pack it as "dnatool.zip" in windows.
How can compile for MAC or unix source ? What steps are different ?
Unix source: dnatool.tar.gz
Mac OS X binary: dnatool.tgz
Do I need Mac computer to do. I do have linux virtualbox and installed ubuntu in it ?
Edit:
Should I use the following commad to get sourcode binary from step (3) folder dnatool ?
$ tar -zcvf dnatool.tar.gz/home/dnatool