Install R packages through Jobs tab in Rstudio
There's an R package {job}
which can be used to run any r code directly from a script or console. To install a package as a Rstudio job:
# install.packages("job")
job::job({
install.packages("pkg_name")
})
Also {job}
provides Rstudio Addins to easily run selected code as a job.
see here for more examples.
Why does R show a package error immediately when I open the program?
Based on responses in the comments, I'll promote my comment to an answer.
Two possible causes of this problem are
- you have a
.Rprofile
file in your home directory that is trying to load packages - you have a
.RData
file in your current working directory that is being auto-loaded; it has an object in it that will trigger the loading of this package
Note that in either case files whose names start with a .
are usually invisible by default in file managers/file listings, so you may have to search for them carefully
file.exists(".RData")
and file.exists("~/.Rprofile")
will tell you whether these files exist; you could diagnose the problem by moving/renaming each one temporarily.
Installing an R package from local unzipped folder
If it is an unzipped Windows binary (e.g., from CRAN), you can just copy and paste the entire package directory into your library folder. You could also, presumably, use file.copy()
to do so if you wanted to do it within R. install.packages()
is failing (weirdly) because you're giving it something other than the typical package source or zipped binary that it is expecting.
Related Topics
R Reshape2 'Aggregation Function Missing: Defaulting to Length'
R Looping Through in Survey Package
Different Y-Limits on Ggplot Facet Grid Bar Graph
Adding All Elements of Two Lists
System Is Computationally Singular: Reciprocal Condition Number in R
Find the Nearest X,Y Coordinate Using R
How to Plot X-Axis Labels and Bars Between Tick Marks in Ggplot2 Bar Plot
Ggplot Inserting Space Before Degree Symbol on Axis Label
Converting Date Column in Data Frame
R - Data Frame - Convert to Sparse Matrix
From [Package] Import [Function] in R
How to Replace the String Exactly Using Gsub()
How to Show a Loading Screen When the Output Is Being Calculated in a Background Process