Creating a local R package repository
Yes, either a copy of CRAN or a repo with local packages is easy to set up. Presumably you want this for Windows so do this:
- Create a top-level directory on your webserver, say
R/
- Create the usual hierarchy in there:
R/bin/windows/contrib/2.11
. If you need to support other (earlier) releases, simply create directories2.10
,2.9
, ... next to the2.11
directory. Place the packages you need into the directory (say,
2.11
), then change into that directory and run the following command to generatePACKAGES
andPACKAGES.gz
files for the repository:tools::write_PACKAGES(".", type="win.binary")
That is all there is to it -- now you can access the repository by pointing to the address given a command such as
update.packages(repos="http://my.local.server/R", ask=FALSE)
which I even do in R/zzz.R
for local packages so that they update themselves.
Edit some five+ years later: And the drat package now automates a lot of this, and shines particularly if you also use GitHub to serve the repository over http/https (but is useful for other or local hosting too).
R - setting up my own CRAN repository
You might just need to specify the URL properly; http://127.0.0.1/R
.
Also, make sure you can access that URL in your browser.
R-Studio setup with offline CRAN repository in Windows
I managed to solve this problem by creating a local webserver using Apache and then downloading full CRAN repository (win binaries only). I also had to edit my Rprofile.site file by providing the link to my local webserver.
R script: Installing packages from offline miniCRAN, still tries to access internet
My bad. The script should look like this:
install.packages('yaImpute',
repos = paste0("file:///", "C:/Temp/miniCRAN/"),
type = "source")
Related Topics
How to Extract the Row with Min or Max Values
Change Row Order in a Matrix/Dataframe
How Subset a Data Frame by a Factor and Repeat a Plot for Each Subset
Change the Default Colour Palette in Ggplot
Marker Mouse Click Event in R Leaflet for Shiny
Ggmap Error: Geomrasterann Was Built with an Incompatible Version of Ggproto
Emulate Split() with Dplyr Group_By: Return a List of Data Frames
Delete Columns/Rows with More Than X% Missing
Connecting Across Missing Values with Geom_Line
Dplyr::Group_By_ with Character String Input of Several Variable Names
Plotting with Ggplot2: "Error: Discrete Value Supplied to Continuous Scale" on Categorical Y-Axis
Download a File from Https Using Download.File()
Same Function Over Multiple Data Frames in R
How to Insert an Image into the Navbar on a Shiny Navbarpage()
Extract a Column from a Data.Table as a Vector, by Position
Stacked Bar Chart in R (Ggplot2) with Y Axis and Bars as Percentage of Counts
Joining Aggregated Values Back to the Original Data Frame
Rbind Data Frames Based on a Common Pattern in Data Frame Name