Installing an R package from the source files - r

I am trying to install the r package "segue" from the source. Unfortunately, there's no tarball provided at this time, and I don't know how to compile and install a package from the binary files. I'm on a mac, if that helps.
Thanks!

As the author of Segue, I threw you a bone and rolled the tar ball for you :)
What you see on the Google Code page is not the binary files, they are the source files. Now me doing it for you is not that helpful for helping you understand packages. So if you wanted to build this yourself, here's how you would do it:
clone the source tree so you have a local copy on your machine. Make sure you have Mercurial installed and then type hg clone https://segue.googlecode.com/hg/ segue to clone the code to your machine.
build the package, test it, and install with the following three commands:
R CMD build segue/
R CMD check segue_0.02.tar.gz
R CMD INSTALL segue_0.02.tar.gz
I've never actually used a Mac so I think these commands are right. I know they work on Linux. So let me know if I need to alter these instructions for Mac. You're helping me write documentation!

Related

How to use R CMD INSTALL to install only essential files

I am using R CMD INSTALL to install libraries from a folder with .zip binaries to my rlibs directory. When I do this, many folders for each library are installed in the rlibs directory. Take for example the bit package. I have downloaded the bit_1.1-12.zip file from https://cran.r-project.org/web/packages/bit/index.html.
Now I install it by using the following command:
R CMD INSTALL --library=./r_libs ./external/bit_1.1-12.zip
This will create a file structure underneath the folder ./r_libs/bit
Now here is my question: How can I install only the essential library files that R needs to import? I believe this is the ./r_libs/bit/libs/ folder (I might be wrong). Currently there is plenty of additional folders installed, such as html, help, Meta, and more.
I have tried several options that R CMD INSTALL --help gives me. The description in https://stat.ethz.ch/R-manual/R-devel/library/utils/html/INSTALL.html tells me to install just the compiled code for another sub-architecture, use --libs-only. However,
R CMD INSTALL --libs-only --library=./r_libs ./external/bit_1.1-12.zip
gives me an error message that there is no ./r_libs/bit/lib directory. The options --no-html, --no-help seem to not do anything.
I am working on a Windows 7 machine using R add-on package installer 3.0.2.
What am I missing here?
Thank you.

How to build R package from GitHub?

I try to build fork of R package from github (this fork has a fresh bugfix). I am able to build AND install the package from github:
require(devtools)
install_github("patcpsc/rredis", build_vignettes = FALSE)
However, this doesn't produce installable package - or does it? I need to install this package on 15 machines so I prefer to build the package once and then copy and install it on the other machines.
I tried to look for funciton like build_github, unfortunatelly there is none. How do I do it?
github has help documentation on how to fork a repository. It sounds like you've done the first part. Now you just need to clone the repository. That means taking a copy for your local machine so you can work on it. The buttons you want are on the right. Clone in desktop is for when you use the Github desktop software. If you are running git from a command line, type
git clone git#github.com:whatever-the-link-is-in-the-SSH-clone-url-textbox
Once you have a local copy of the repository, in R you do
library(devtools)
build("path/to/package/root")
I thought you wanted to actually work on the package. If you just want to download the source, there's a "Download ZIP" button right underneath the clone options. Download, unzip, then build in R as above.
It's old question and a lot changes since 2014. Now the workhorse is remotes package.
If you want installable package there is one created in your temp directory.
I usually don't want install so I create temporary library:
dir.create(tmp_lib <- "tmp_lib")
.libPaths(c(tmp_lib,.libPaths()))
.libPaths()
But you can skip that if not needed, now standard:
require(devtools)
install_github("patcpsc/rredis", build_vignettes = FALSE)
Now navigate to your temp location given by tempdir() (in Windows shortcut is: shell.exec(tempdir())).
You should see folder [fileXXXXXXXX] which should contain rredis_1.6.9.tar.gz file. This is what you need.
unlink(tmp_lib, recursive=TRUE) cleanup your temp directory.

cygwin aspell installing new language

have a problem with adding new language to cygwin.
As source for language i tried using ubuntu dictionary files.
It would be interesting if anyone could install any non default languages in cygwin spell checker.
The Ubuntu packages use different directories (/usr/lib/aspell vs. /usr/lib/aspell-0.60 on Cygwin), so this isn't going to work. Instead, I suggest you build and install these from the source in one of the following ways:
Download the latest source tarball for your language from http://ftpmirror.gnu.org/aspell/dict/, unpack the tarball, then run ./configure, make, and make install.
Use cygport to build a package for you, then manually install it. For example, create an aspell-lt.cygport file with the following contents:
ASPELL_COMPAT=6
inherit aspell-dict
NAME="aspell-lt"
VERSION=1.2.1.0
RELEASE=1
CATEGORY="Text"
SUMMARY="Aspell Lithuanian dictionaries"
Then run cygport aspell-lt.cygport fetch prep build install package. Such a package would then be fit for contribution to the Cygwin distribution.

How can I build a stand alone R engine with some packages included?

I have a windows server that does not allow me to install anything but it allows me to run exe files (Meaning that I cannot simply download the R installation package and install R that way). I want to run R on it and I like to know if it is possible for me to make an R.exe with some packages like ggplot and lattice included?
Do you have any filestore on the server? I can't imagine that you wouldn't have. You can install packages to any directory, which can then be your own personal library. Look at the help(install.packages) and help(library) and there's a lib or lib.loc argument that tells it where to stick it.
If the reason you can't install is because install.packages can't get through the network to CRAN, then download the binary from CRAN, transfer it to the server, and install that way.
Note that I didn't answer your question about building an R exe with bundled packages (here's that answer: "No") because you thought the answer to that question was the solution to your real problem ("I can't install packages"). Always ask a question to your original problem...
I ran across the portable version of R that could do it for me. It generates a folder that can be moved to the new server.
http://sourceforge.net/projects/rportable/

How do I install an R package from the source tarball on windows?

The forecast package for R has been updated to version 2.12, but there are currently only windows binarys for 2.11 available on CRAN.
How do I install an R package from the source on Windows?
I know this is an old question but it came up first in my Google search for this same question, even though I knew the answer I just wanted something to copy and paste. Which makes it worth improving the answer for future reference. So here is what works for me:
Install rtools, then:
install.packages(path_to_file, repos = NULL, type="source")
Two answers that may help you avoid the hassle of installing Rtools.
Use http://win-builder.r-project.org/ to build a binary version, download it, and install (using install.packages(...,repos=NULL))
If the package has no binary component (i.e. no src directory with C, C++, or Fortran code that needs to be compiled during installation (not true for forecast, but possibly useful some other time) then simply specifying type="source" within the install.packages call (whether from a repository or a local copy of the source tarball (.tar.gz file)) will install the source package, even on Windows.
Start by reviewing the section on Windows packages in the R Installation and Administration manual, then carefully follow the instructions from The Windows toolset appendix.
I know it's usually bad form to mainly provide links in an answer, but these are links to the canonical references on this topic. I simply link to them rather than summarize their contents, since they should be accurate for the most current R release.
I'm not sure if this is the best way, but I found the following method to work (based in part on the answers above):
1) Download the package .tar
2) Move the package to the directory with your user R libraries (e.g., in my case it was "C:/Users/yourUserName/Documents/R/win-library/3.3")
3) Within Rstudio (or elsewhere, probably), run the command... install.packages("packageName.tar", repos=NULL, type="source")
That worked for me at least. Hope it's helpful!
Download the package *.tar.gz.
make sure you have Rtools installed.
Make sure the R and Rtools paths are added in the environment varialble.
Open a command prompt. Type R CMD INSTALL packagename.tar.gz.
it will work i hope.
To install a package from a .tar.gz file, follow these steps:
Launch R to have the R command prompt
Type: install.packages(<path_to_tar.gz_file>, repos = NULL)
or launch directly:
R CMD INSTALL <path_to_.tar.gz_file>
You need to have R installed but you don't need RTools

Resources