R install package from tar.gz
Two answers that may help you avoid the hassle of installing Rtools. Ben Bolker Ben Bolker k 23 23 gold badges silver badges bronze badges. 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. Hope it's helpful! Make sure the R and Rtools paths are added in the environment varialble.
Open a command prompt. I am not quite sure i get number 3. How would I add the Rtools path in the environment variable? To install a package from a. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 0. See more linked questions. Related Hot Network Questions. The last option is to use the menu. In case you have the zip hosted in some URL you can use the install.
Note you can also install packages from CRAN even older versions this way. If you need to install several packages at once without writing the same function over and over again, you can make use of the c function within the install.
Note that now the quotation marks are needed to specify the packages names. In the following sections you will learn how to install packages from other available sources. GitHub is a well-known code sharing platform. If you go to the page, you can search for R packages using the search bar and writing something like: plot package language:R in case you want to look for graphics packages. Suppose, for instance, that you want to download the development version of the ggplot2 package from GitHub.
The URL would look like:. The first step is to install and load the devtools package, available in CRAN. In case you encounter some error means you also need to install the RTools. The :: operator allows you to call functions from a package without the need of loading it. R Forge project is a web with package development tools and repositories.
As an example, if you would like to install the MPAgenomics package, you have to specify in the repos argument of the install. The dependencies argument is used when repos is not NULL , to specify whether the dependencies of the package that are not installed must be installed or not. Bioconductor is another project that hosts tools and R packages for analyzing biological data. First, you need to install the BiocManager package. It is worth to mention that you can see the full list of Bioconductor packages in R writing BiocManager::available.
For more information about the Bioconductor installation process refer to the official Bioconductor R packages page. Updating R packages can be tedious if you have to reinstall the packages over and over again when some has a newer version. R-level and C-level domains are subtly different, for example in the way strings are canonicalized before being passed for translation.
However, if a specific translation catalogue exists but does not contain a translation, the less specific catalogues are consulted. Translations in the right language but the wrong charset are made use of by on-the-fly re-encoding. Almost all current CPU s have both and bit sets of instructions.
For most a bit version is the default, but for some e. The principal difference is in the size of the pointers. R allocates memory for large objects as needed, and removes any unused ones at garbage collection.
When the sizes of objects become an appreciable fraction of the address limit, fragmentation of the address space becomes an issue and there may be no hole available that is the size requested. This can cause more frequent garbage collection or the inability to allocate large objects.
So, for speed you may want to use a bit build especially on a laptop , but to handle large datasets and perhaps large files a bit build. You can often build both and install them in the same place: See Sub-architectures. This is done for the Windows binary distributions. Even on bit builds of R there are limits on the size of R objects see help "Memory-limits" , some of which stem from the use of bit integers especially in Fortran code.
The routines supporting the distribution and special 45 functions in R and a few others are declared in C header file Rmath. These can be compiled into a standalone library for linking to other applications. Note that they are not a separate library when R is built, and the standalone version differs in several ways.
A little care is needed to use the random-number routines. You will need to supply the uniform random number generator.
This takes values from the enumeration type. If R has not already been made in the directory tree, configure must be run as described in the main build instructions. The example file test. Note that you will probably not be able to run it unless you add the directory containing libRmath. You need to set up 46 almost all the tools to make R and then run in a Unix-like shell.
This creates a static library libRmath. If you want an import library libRmath. This will use the first found of libRmath. You should be able to force static or dynamic linking via. It is possible to link to Rmath. Auto-import will probably work with MinGW-w64, but it is better to be sure. This appendix gives details of programs you will need to build R on Unix-like platforms, or which will be used by R if found by configure.
Next: Useful libraries and programs , Previous: Essential and useful other programs under a Unix-alike , Up: Essential and useful other programs under a Unix-alike [ Contents ][ Index ]. You need a means of compiling C and Fortran 90 see Using Fortran. For versions of gcc prior to 5. Note that options essential to run the compiler even for linking, such as those to set the architecture, should be specified as part of CC rather than in CFLAGS.
The command-line editing and command completion depends on the GNU readline library including its headers : version 6. A suitably comprehensive iconv function is essential. The OS needs to have enough support 52 for wide-character types: this is checked at configuration. Some C99 functions 53 are required and checked for at configuration.
Installations of zlib version 1. Either PCRE1 version 8. Only the 8-bit library and headers are needed if these are packaged separately. JIT support optional is desirable for the best performance. Library libcurl version 7. Information on libcurl is found from the curl-config script: if that is missing or needs to be overridden 58 there are macros to do so described in file config. A tar program is needed to unpack the sources and packages including the recommended packages.
A version 59 that can automagically detect compressed archives is preferred for use with untar : the configure script looks for gtar and gnutar before tar — use environment variable TAR to override this. You will not be able to build most of the manuals unless you have texi2any version 5. To make PDF versions of the manuals you will also need file texinfo. If you want to build from the R Subversion repository then texi2any is highly recommended as it is used to create files which are in the tarball but not stored in the Subversion repository.
Building PDF package manuals including the R reference manual and vignettes is sensitive to the version of the LaTeX package hyperref and we recommend that the TeX distribution used is kept up-to-date. Note that package hyperref currently requires packages kvoptions , ltxcmds and refcount.
The essential programs should be in your PATH at the time configure is run: this will capture the full paths. The liblzma library is in the public domain and X11, libbzip2 , libcurl and zlib have MIT-style licences. The ability to use translated messages makes use of gettext and most likely needs GNU gettext : you do need this to work with new translations, but otherwise the version of the gettext runtime contained in the R sources will be used if no suitable external gettext is found.
Cairo version 1. These tests will fail if pkg-config is not installed 61 , and might fail if cairo was built statically unless configure option --with-static-cairo is used. Pango is optional but highly desirable as it is likely to give much better text rendering, including kerning. For the best font experience with these devices you need suitable fonts installed: Linux users will want the urw-fonts package.
On platforms which have it available, the msttcorefonts package 62 provides TrueType versions of Monotype fonts such as Arial and Times New Roman. See the R help on X11 on selecting such fonts.
The bitmapped graphics devices jpeg , png and tiff need the appropriate headers and libraries installed: jpeg version 6b or later, or libjpeg-turbo or libpng version 1.
They also need support for either X11 or cairo see above. Should support for these devices not be required or broken system libraries need to be avoided there are configure options --without-libpng , --without-jpeglib and --without-libtiff.
The TIFF library has many optional features such as jpeg , libz , zstd , lzma , webp , jbig and jpeg12 , none of which is required for the tiff devices but may need to be present to link the library usually only an issue for static linking. Option --with-system-tre is also available: it needs a recent version of TRE. An implementation of XDR is required, and the R sources contain one which is likely to suffice although a system version may have higher performance. Use of the X11 clipboard selection requires the Xmu headers and libraries.
These are normally part of an X11 installation e. Some systems notably macOS and at least some FreeBSD systems have inadequate support for collation in multibyte locales.
It will be used by default where available: should a very old or broken version of ICU be found this can be suppressed by --without-ICU. At the time of writing a full installation on Fedora Linux used the following packages and their development versions, and this may provide a useful checklist for other systems:.
Note that the tk. The build process looks for Java support on the host system, and if it finds it sets some settings which are useful for Java-using packages such as rJava and JavaGD : these require a full JDK. This check can be suppressed by configure option --disable-java. See R CMD javareconf --help for details: note that this needs to be done by the account owning the R installation.
Renviron , which suffices to run already-installed Java-using packages. It may be possible to avoid this by specifying an invariant link as the path when configuring. For example, on that system any of.
However, Linux distributions can be confusing: for example Fedora 32 had. At the time of writing java-openjdk was Java For source files with extension. Note that it is detected by the name of the command without a test that it can actually compile Fortran 90 code. Previous: Useful libraries and programs , Up: Essential and useful other programs under a Unix-alike [ Contents ][ Index ]. However, these have to be explicitly requested at configure time: R provides an internal BLAS which is well-tested and will be adequate for most uses of R.
You can specify a particular BLAS library via a value for the configuration option --with-blas and not to use an external BLAS library by --without-blas the default. If neither the option nor the environment variable supply a value, a search is made for a suitable 67 BLAS. The configure code checks that the external BLAS is complete it must include all double precision and double complex routines, as well as LSAME , and appears to be usable. However, an external BLAS has to be usable from a shared object so must contain position-independent code , and that is not checked.
The correct incantation for these is often found via --with-blas with no value on the appropriate platforms. Some of the external BLAS es are multi-threaded. On a machine running other tasks, there can be contention for CPU caches that reduces the effectiveness of the optimization of cache use by a BLAS implementation: some people warn that this is especially problematic for hyperthreaded CPUs.
So if R is re-built to use an enhanced BLAS then packages such as quantreg will need to be re-installed; they may be under other circumstances. This is checked in the test suite.
External BLAS implementations often make less use of extended-precision floating-point registers where available and will almost certainly re-order computations. This can result in less accuracy than using a reference BLAS , and may result in different solutions, e. The URIs for several of these BLAS have been subject to frequent gratuitous changes, so you will need to search for their current locations. The reference implementations are thread-safe but external ones may not be even single-threaded ones : this can lead to hard-to-track-down incorrect results or segfaults.
Unfortunately it is built by default as a static library that on some platforms may not be able to be used with shared objects such as are used in R packages. Such builds can be used by one of. Consult its installation guide 70 for how to build ATLAS as a shared library or as a static library with position-independent code on platforms where that matters.
For the Fedora libraries the compile-time flag specifies 4 threads. There are also versions of MKL for macOS 73 and Windows, but when these have been tried they did not work with the default compilers used for R on those platforms. The MKL interface has changed several times but has been stable in recent years: the following examples have been used with versions With bit builds and the GCC compilers, we used. R does not have to be rebuilt to use MKL, but configure include tests which may discover some errors such as a failure to set the correct OpenMP and MKL interface layer.
For example, just. A similar link works for most versions of the OpenBLAS provided the appropriate lib directory is in the run-time library path or ld. Note that rebuilding or symlinking libRblas. This can only be done if --with-blas has been used.
However, the likely performance gains are thought to be small and may be negative. You can specify a specific LAPACK library or a search for a generic library by the configuration option --with-lapack. If you do use --with-lapack , be aware of potential problems with bugs in the LAPACK sources or in the posted corrections to those sources. Other potential problems are incomplete versions of the libraries, seen several times in Linux distributions over the years.
Reporting problems where it is used unnecessarily will simply irritate the R helpers. As with all libraries, you need to ensure that they and R were compiled with compatible compilers and flags. For example, this has meant that on Sun Sparc using the Oracle compilers the flag -dalign is needed if sunperf is to be used.
This is fixed in the R 3. Probably the most important ones not covered elsewhere are defaults in brackets. You will want to use --disable-R-profiling if you are building a profiled executable of R e.
Flag --enable-R-shlib causes the make process to build R as a dynamic shared library, typically called libR. This can only be done if all the code including system libraries can be compiled into a dynamic library, and there may be a performance 74 penalty. So you probably only want this if you will be using an application which embeds R. Note that C code in packages installed on an R system linked with --enable-R-shlib is linked against the dynamic library and so such packages cannot be used from an R system built in the default way.
Also, because packages are linked against R they are on some OSes also linked against the dynamic libraries R itself is linked against, and this can lead to symbol conflicts. For maximally effective use of valgrind , R should be compiled with valgrind instrumentation. Level 0 is the default and does not add anything. The system headers for valgrind can be requested by option --with-system-valgrind-headers : they will be used if present on Linux they may be in a separate package such as valgrind-devel.
Note though that there is no guarantee that the code in R will be compatible with very old 75 or future valgrind headers. If you need to re-configure R with different options you may need to run make clean or even make distclean before doing so. The configure script has other generic options added by autoconf and which are not supported for R: in particular building for one architecture on a different host is not possible. Translation of messages is supported via GNU gettext unless disabled by the configure option --disable-nls.
If you need or want to set certain configure variables to something other than their default, you can do that by either editing the file config. If you are building in a directory different from the sources, there can be copies of config. There is also a general autoconf mechanism for config. These variables are precious , implying that they do not have to be exported to the environment, are kept in the cache even if not specified on the command line, checked for consistency between two configure runs provided that caching is used , and are kept during automatic reconfiguration as if having been passed as command line arguments, even if no cache is used.
See the variable output section of configure --help for a list of all these variables. If you find you need to alter configure variables, it is worth noting that some settings may be cached in the file config. Note that caching is turned off by default: use the command line option --config-cache or -C to enable caching. This is used both when configuring R to set the default, and when running R to override the default.
It is also used to set the paper size when making PDF manuals. If you have libraries and header files, e. In this case, use a different compiler or a front-end shell script which does the re-ordering. These flags can also be used to build a faster-running version of R. Tuning compilation to a specific CPU family e. To compile R, you need a Fortran 90 compiler. The current default is to search for gfortran , g95 , xlf95 f95 , fort , ifort , ifc , efc , pgfortran , pgf95 lf95 , ftn , nagfor , xlf90 , f90 , pgf90 , pghpf , epcf Note that these are searched for by name, without checking the standard of Fortran they support.
The command and flags used should support fixed-form Fortran with extension. The search mechanism can be changed using the configure variable FC which specifies the command that runs the Fortran compiler.
If your Fortran compiler is in a non-standard location, you should set the environment variable PATH accordingly before running configure , or use the configure variable FC to specify its full path. You must set whatever compilation flags if any are needed to ensure that Fortran integer is equivalent to a C int pointer and Fortran double precision is equivalent to a C double pointer.
This is checked during the configuration process. A wide range of flags can be set in the file config. We have already mentioned. Since R as a shared library has about symbols, if in doubt use the larger version. These are for options which are always required, for example to force IEC compliance. There are several files that are part of the R sources but can be re-generated from their own sources by configuring with option --enable-maintainer-mode and then running make in the build directory.
This requires other tools to be installed, discussed in the rest of this section. File configure is created from configure. There is a formal version requirement on autoconf of 2. It is known that earlier versions of bison generate code which reads and in some cases writes outside array bounds: bison 2.
The ultimate sources for package compiler are in its noweb directory. Some Linux distributions include this command in package noweb.
This section provides some notes on building R on different Unix-alike platforms. These notes are based on tests run on one or two systems in each case with particular sets of compilers and support libraries.
Success in building R depends on the proper installation and functioning of support software; your results may differ if you have other versions of compilers and support libraries. C macros to select particular platforms can be tricky to track down there is a fair amount of misinformation on the Web.
As its name implies, it displays on a local or remote X server, and relies on the services provided by the X server. When X11 was designed, most displays were around 75dpi, whereas today they are of the order of dpi or more. If you find that X11 is reporting 78 missing font sizes, especially larger ones, it is likely that you are not using scalable fonts and have not installed the dpi versions of the X11 fonts.
More complicated problems can occur in non-Western-European locales, so if you are using one, the first thing to check is that things work in the C locale.
The likely issues are a failure to find any fonts or glyphs being rendered incorrectly often as a pair of ASCII characters. X11 works by being asked for a font specification and coming up with its idea of a close match. For text as distinct from the symbols used by plotmath , the specification is the first element of the option "X11fonts" which defaults to. If you are using a single-byte encoding, for example ISO in Eastern Europe or KOI8-R in Russian, use xlsfonts to find an appropriate family of fonts in your encoding the last field in the listing.
Multi-byte encodings most commonly UTF-8 are even more complicated. In such locales fontsets are used, made up of fonts encoded in other encodings.
If not, you may have to get hold of a suitable locale entry for X On some systems scalable fonts are available covering a wide range of glyphs. Another is Type 1 fonts: the URW set of Type 1 fonts provides standard typefaces such as Helvetica with a larger coverage of Unicode glyphs than the standard X11 bitmaps, including Cyrillic.
These are generally not part of the default install, and the X server may need to be configured to use them. They might be under the X11 fonts directory or elsewhere, for example,. Linux is the main development platform for R, so compilation from the sources is normally straightforward with the most common compilers and libraries.
Recall that some package management systems such as RPM and deb make a distinction between the user version of a package and the developer version. You should expect to see in the configure summary. When R has been installed from a binary distribution there are sometimes problems with missing components such as the Fortran compiler. It is also possible to increase the optimization levels to -O3 : however for many versions of the compilers this has caused problems in at least one CRAN package.
It may also be necessary to set the pkg-config path, e. Note that bit glibc before version 2. NB: this affects more than floating-point operations. For some OSes and versions of gcc it might be necessary to add -mstackrealign.
For the latter, if the Fortran compiler is GNU gfortran or possibly g77 the flags. For example Fedora adds. These take very similar options to the corresponding GCC compilers. This has to be used in conjunction with a Fortran compiler: the configure code will remove -lgcc from FLIBS , which is needed for some versions of gfortran. Recent versions have optional when built OpenMP support. This needs something like. Note that flang accepts all the flags which clang does the driver is a modified version of clang , and flang is a symbolic link to clang , but does not implement all of them for Fortran compilation: it also accepts most PGI-style flags such as -mp for OpenMP.
It currently produces few diagnostics even with -Wall -pedantic. So it may be necessary to disable the latter by configuring R using --disable-openmp. Brian Ripley used version 9. Others have reported success with versions
0コメント