Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
716 votes
19 answers
1.0m views

How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

I tried to install a package, using install.packages("foobarbaz") but received the warning Warning message: package 'foobarbaz' is not available (for R version x.y.z) Why doesn't R think that the ...
Richie Cotton's user avatar
675 votes
12 answers
576k views

How to unload a package without restarting R

I'd like to unload a package without having to restart R (mostly because restarting R as I try out different, conflicting packages is getting frustrating, but conceivably this could be used in a ...
Ari B. Friedman's user avatar
672 votes
8 answers
174k views

What is the difference between require() and library()?

What is the difference between require() and library()?
Marco's user avatar
  • 9,564
575 votes
13 answers
687k views

How to find out which package version is loaded in R?

I am in a process of figuring out how to use my university cluster. It has 2 versions of R installed. System wide R 2.11 (Debian 6.0) and R 2.14.2 in non-standard location. I am trying to use MPI ...
mpiktas's user avatar
  • 11.5k
451 votes
35 answers
256k views

Elegant way to check for missing packages and install them?

I seem to be sharing a lot of code with coauthors these days. Many of them are novice/intermediate R users and don't realize that they have to install packages they don't already have. Is there an ...
Maiasaura's user avatar
  • 32.7k
281 votes
4 answers
334k views

Where does R store packages?

The install.packages() function in R is the automatic unzipping utility that gets and install packages in R. How do I find out what directory R has chosen to store packages? How can I change the ...
Milktrader's user avatar
  • 9,708
238 votes
11 answers
335k views

How to select a CRAN mirror in R

I'm trying to install a package through the R prompt by doing the following: install.packages('RMySQL') But the output is as follows: --- Please select a CRAN mirror for use in this session --- ...
Jim Johnson's user avatar
  • 2,589
235 votes
10 answers
149k views

Load multiple packages at once

How can I load a bunch of packages at once with out retyping the require command over and over? I've tried three approaches all of which crash and burn. Basically, I want to supply a vector of ...
Tyler Rinker's user avatar
202 votes
19 answers
228k views

Problems installing the devtools package

I wish to use the devtools package. I've run the following commands: > install.packages("devtools", dependencies = TRUE) .... > library(devtools) Error in library(devtools) : there is no ...
Evan Aad's user avatar
  • 5,879
185 votes
16 answers
226k views

Check for installed packages before running install.packages() [duplicate]

I have an R script that is shared with several users on different computers. One of its lines contains the install.packages("xtable") command. The problem is that every time someone runs the script, ...
Waldir Leoncio's user avatar
177 votes
12 answers
69k views

Painless way to install a new version of R?

Andrew Gelman recently lamented the lack of an easy upgrade process for R (probably more relevant on Windows than Linux). Does anyone have a good trick for doing the upgrade, from installing the ...
Shane's user avatar
  • 99.7k
171 votes
10 answers
35k views

How to organize large R programs?

When I undertake an R project of any complexity, my scripts quickly get long and confusing. What are some practices I can adopt so that my code will always be a pleasure to work with? I'm thinking ...
Dan Goldstein's user avatar
112 votes
6 answers
141k views

R install.packages returns "failed to create lock directory"

I get this error when downloading the Rcpp package: > install.packages("Rcpp", dependencies=TRUE) Installing package(s) into ‘/home/me/src/Rlibs’ (as ‘lib’ is unspecified) trying URL 'http://cran....
tflutre's user avatar
  • 3,496
107 votes
2 answers
250k views

What does "The following object is masked from 'package:xxx'" mean?

When I load a package, I get a message stating that: "The following object is masked from 'package:xxx' For example, if I load testthat then assertive, I get the following: library(testthat) ...
Richie Cotton's user avatar
95 votes
6 answers
206k views

Get the list of installed packages by user in R

How we can get the list of installed packages by user in R along with its version? I know about the command installed.packages() which will give information about all packages (base or non-base). But ...
989's user avatar
  • 12.8k
84 votes
3 answers
106k views

How to install multiple packages?

How would I got about installing multiple packages in R? I tried the following code: install.packages("EIAdata", "gdata", "ggmap", "ggplot2","gridExtra","ISOweek","kobe","lubridate","maps","MASS","...
user2946746's user avatar
  • 1,760
82 votes
2 answers
152k views

Function to calculate geospatial distance between two points (lat,long) using R [duplicate]

I have geocoded points in long, lat format, and I want to calculate the distance between them using R. This seems pretty straight forward, yet I can't find a function that will do it easily. I've ...
SteveO7's user avatar
  • 2,450
80 votes
4 answers
81k views

R: 2 functions with the same name in 2 different packages

I need to load to R packages : tseries and chron Both have a function named is.weekend I always have in my environment the function from the second package I loaded. How can I access always the ...
RockScience's user avatar
  • 18.3k
77 votes
8 answers
15k views

Diagnosing R package build warning: "LaTeX errors when creating PDF version"

When building a package, I received the following warning: * checking PDF version of manual ... WARNING LaTeX errors when creating PDF version. This typically indicates Rd problems. I have no idea ...
Ari B. Friedman's user avatar
77 votes
3 answers
32k views

How do you use multiple versions of the same R package?

In order to be able to compare two versions of a package, I need to able to choose which version of the package that I load. R's package system is set to by default to overwrite existing packages, so ...
Richie Cotton's user avatar
77 votes
2 answers
10k views

Create an R package that depends on another R package located on GitHub

I am creating an R package on GitHub, LW1949, that depends on another R package on GitHub, jvamisc. When I try to install LW1949 using require(devtools) devtools::install_github("user/LW1949") I ...
Jean V. Adams's user avatar
75 votes
13 answers
85k views

Windows 7, update.packages problem: "unable to move temporary installation"?

I am using R 2.13.0 with windows 7, after giving my user full privileges to the R folder (as described here). This allows me to install new packages just fine. However, when using update.packages(), ...
Tal Galili's user avatar
  • 25.1k
69 votes
2 answers
9k views

Warning about UTF-8 with roxygen2

I have a problem about UTF-8. After conducting roxygen2::roxygenise() for my package, it showed the warning message 'roxygen2 requires Encoding: UTF-8'. How can I fix it? roxygen2::roxygenise() &...
Lann's user avatar
  • 795
67 votes
9 answers
142k views

Error in installation a R package

Please help me, I cannot install "MASS" package. > library(MASS) Error in library(MASS) : there is no package called ‘MASS’ I tried to install MASS package from local: > utils:::...
parvij's user avatar
  • 1,390
67 votes
4 answers
29k views

Cannot install R-forge package using install.packages

This, question, is, asked, over, and, over, and, over, on the R-sig-finance mailing list, but I do not think it has been asked on stackoverflow. It goes like this: Where can I obtain the latest ...
GSee's user avatar
  • 49.5k
63 votes
2 answers
14k views

Multiple functions in one .Rd file

Short version: Can I emulate the documentation of Normal in package stats using roxygen? Long version: I'm working on a package and was trying make the documentation more readable by having a number ...
dardisco's user avatar
  • 5,244
62 votes
2 answers
29k views

inst and extdata folders in R Packaging

In the documentation, R suggests that raw data files (not Rdata nor Rda) should be placed in inst/extdata/ From the first paragraph in: http://cran.r-project.org/doc/manuals/R-exts.html#Data-in-...
Brandon Bertelsen's user avatar
62 votes
5 answers
172k views

R not finding package even after package installation

I have always worked with the zoo package, that I have installed a long time ago. Today, I created a new R script, and ran library(zoo) and got the following error: > library(zoo) Error in ...
Mayou's user avatar
  • 8,728
61 votes
6 answers
35k views

Listing R Package Dependencies Without Installing Packages

Is there a simple way to get a list of R package dependencies (all recursive dependencies) for a given package, without installing the package and it's dependencies? Something similar to a fake ...
Jonathan Lisic's user avatar
61 votes
7 answers
52k views

How to install dependencies when using "R CMD INSTALL" to install R packages?

I'm developing my first R package (using R 2.13, Ubuntu 10.10). Let's call it foo and let's say that the code in the R/ directory begins with the line library(bar), where bar is an existing package ...
neilfws's user avatar
  • 33.5k
58 votes
5 answers
37k views

Install a local R package with dependencies from CRAN mirror

I have built an R package, i.e. I have the mypackage.tar.gz file. This package depends on several other packages, all downloadable and installable from any CRAN mirror. Now I want to install this ...
WoDoSc's user avatar
  • 2,608
58 votes
2 answers
3k views

Rd file name conflict when extending a S4 method of some other package

Actual question How do I avoid Rd file name conflicts when a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) ...
Rappster's user avatar
  • 13k
53 votes
5 answers
17k views

Rbuildignore and Excluding Directories

I am interested in excluding two directories inst\docs and inst\examples while building and installing the package. I know that an easy way out is just to move docs and examples to the root directory ...
Ramnath's user avatar
  • 55.3k
52 votes
4 answers
54k views

How do I install a package that has been archived from CRAN?

I typed the following in the R command line: install.packages("RecordLinkage") I got the following error: Warning in install.packages : package ‘RecordLinkage’ is not available (for R version 3....
Rainmaker's user avatar
  • 1,221
52 votes
7 answers
36k views

How to tell what packages you have used in R

I have a very long R script with many if statements and exception cases. As i've been going, if been importing and testing libraries as I've gone and haven't really documented them very well. The ...
aeongrail's user avatar
  • 1,374
48 votes
2 answers
5k views

Writing robust R code: namespaces, masking and using the `::` operator

Short version For those that don't want to read through my "case", this is the essence: What is the recommended way of minimizing the chances of new packages breaking existing code, i.e. of making ...
Rappster's user avatar
  • 13k
47 votes
5 answers
13k views

No visible binding for global variable Note in R CMD check

I noticed in checking a package that I obtain notes "no visible binding for global variable" when I use functions like subset that use verbatim names of list elements as arguments. For example with a ...
Sacha Epskamp's user avatar
45 votes
5 answers
21k views

NAMESPACE not generated by roxygen2. Skipped. - Confusion with Hadley book

I am trying to make a package but when I run document() it prints NAMESPACE not generated by roxygen2. Skipped. I am trying to use ggplot2,XML, R6 packages in my functions. I am importing them in the ...
melatonin15's user avatar
  • 2,199
45 votes
1 answer
2k views

Must R Packages Unload Dynamic Libraries When They Unload?

From Hadley's C best practices: Like with C++, whenever you use C code in your package, you should unload the DLL when the package is unloaded: .onUnload <- function (libpath) { library.dynam....
BrodieG's user avatar
  • 52.4k
43 votes
4 answers
18k views

R create reference manual with R CMD check

I am writing an R package and would like to make a pdf reference manual of all functions in the package. I understood from here that R CMD check automatically creates a reference manual. Here I read ...
user1981275's user avatar
  • 13.2k
43 votes
5 answers
97k views

R "stats" citation for a scientific paper

I analyzed my data using R package ‘stats’ (version 2.15.3). A reviewer asked me the right citation of this package and not only the common R Core Team (2012). R: A language and environment for ...
Gianni Spear's user avatar
  • 7,644
43 votes
2 answers
107k views

How to uninstall R and RStudio with all packages, settings and everything else?

I messed up something and there is a problem with tidyverse. Tried to find a solution but spend lots of time without result. How to uninstall R and RStudio with all packages, settings and everything ...
vasili111's user avatar
  • 6,590
43 votes
1 answer
12k views

What constitutes a good package name according to CRAN? [closed]

I'm searching a good name for a R package I want to send to the CRAN. I didn't find any information about good practice in R package namming. There is a post about how to analyze packages names but it ...
jomuller's user avatar
  • 1,042
41 votes
7 answers
4k views

"import as" in R

Is there a way to import a package with another name in R, the way you might with import as in Python, e.g. import numpy as np? I've been starting to use package::function lately to avoid conflicts ...
shadowtalker's user avatar
  • 13.5k
39 votes
2 answers
10k views

In R, what does "loaded via a namespace (and not attached)" mean?

In R, what does it mean for a package to be "loaded via a namespace (and not attached)" in sessionInfo()? Edit: For example: > sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-apple-...
MadSeb's user avatar
  • 8,154
38 votes
6 answers
73k views

Loading an R Package from a Custom directory

If I download an "package-name".tar.gz file from CRAN website, gunzip and untar it into a custom directory, how do I load that package from within R? I cannot extract the file in the R installation ...
rlh2's user avatar
  • 1,079
38 votes
2 answers
14k views

R: what's the proper way to overwrite a function from a package?

I am using a R package, in which there are 2 functions f1 and f2 (with f2 calling f1) I wish to overwrite function f1. Since R 2.15 and the mandatory usage of namespace in packages, if I just ...
RockScience's user avatar
  • 18.3k
37 votes
2 answers
16k views

How do I show the source code of an S4 function in a package?

I used the packages topGO in R to analyze gene enrichment with the following code: sampleGOdata <- new("topGOdata", description = "Simple session", ontology = "BP", allGenes =...
Lisann's user avatar
  • 5,825
37 votes
12 answers
72k views

Installing R Packages Error in readRDS(file) : error reading from connection

Whenever I try to install any package in R on Ubuntu 14.04, I'm getting the following error: Error in readRDS(file) : error reading from connection I already tried the methods given here but could ...
MYaseen208's user avatar
  • 23.6k
37 votes
2 answers
5k views

NOTE in R CRAN Check: No repository set, so cyclic dependency check skipped

As of R 3.1.0 I get the following R check: * checking package dependencies ... NOTE No repository set, so cyclic dependency check skipped I tried this advice: https://twitter.com/phylorich/status/...
Tyler Rinker's user avatar

1
2 3 4 5
63