# distributing code to others

#### andy_b

##### New Member
So i want to send my code to someone to use with the ability to adapt it if needed.

I should say that i am new to R so i may ask some dumb questions. please bear with me.

i tried -successfully- to create a package, however all of the R files containing the code have been converted to a non readable format.

Is there an elegant way to package up the code with data and send it to someone so they can continue to modify it? Is the only way just to zip them up?

thanks

#### Dason

##### Ambassador to the humans
How did you package it up? Did you use the command line? If so did you use R CMD INSTALL or did you use R CMD build?

Personally the way I like to share code is through github. Here is an example: https://github.com/Dasonk/timestamp and here is a package that trinker and I are collaborating on https://github.com/trinker/pacman

You need to know how to use git but if you aren't already using version control software of some kind I would highly encourage you to learn it! It's pretty easy to use and incredibly useful. Then anybody can 'fork' or 'clone' the repository so that they can have the code on their local machine and make changes if they want. Then if they think their changes are useful they can send a pull request to you so that you can automatically merge their changes into your code base easily.

With that said essentially what the R CMD build process is doing is compressing the package in a specific way so if you just want to zip it up you really wouldn't lose much.

#### andy_b

##### New Member
i used R CMD build

i will take a look at github. thanks for the advice.
I am a really a MATLAB user but have been looking forward to learning R for some time now. I guess i am in the "i dont know a lot so get frustrated easily" stage.

thanks again

#### trinker

##### ggplot2orBust
Once you've used R CMD build others can use:

Code:
install.packages(path/to/package.tar.gz, repos = NULL, type="source")
PS Rstudio + devtools + roxygen2 will make this less fustrating