Reset R's library to base packages only (remove all installed contributed packages)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reset R's library to base packages only (remove all installed contributed packages)

Janko Thyson-2
Dear list,

is there a way to comfortably "reset" R's library such that it only
contains only the base packages again? In other words, how can I
uninstall all contributed packages that I installed? Is there some sort
of index that's keeping track of what has been installed? If so, a
pointer would be great.

AFAIU, if you don't create such an "index file" yourself and loose track
of what you installed, probably the best way to "reset" R is to actually
re-install it. That's exactly what I'm trying to avoid.

I would like something like

path.lib <- "path/to/R/lib"
pkgs.to.remove <- readLines(path.to.index.file)
sapply(pkgs.to.remove, uninstall.packages, lib=path.lib)

Best regards,
Janko

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Reset R's library to base packages only (remove all installed contributed packages)

Uwe Ligges-3


On 14.06.2011 12:04, Janko Thyson wrote:

> Dear list,
>
> is there a way to comfortably "reset" R's library such that it only
> contains only the base packages again? In other words, how can I
> uninstall all contributed packages that I installed? Is there some sort
> of index that's keeping track of what has been installed? If so, a
> pointer would be great.
>
> AFAIU, if you don't create such an "index file" yourself and loose track
> of what you installed, probably the best way to "reset" R is to actually
> re-install it. That's exactly what I'm trying to avoid.
>
> I would like something like
>
> path.lib <- "path/to/R/lib"
> pkgs.to.remove <- readLines(path.to.index.file)

ip <- installed.packages()
pkgs.to.remove <- ip[!(ip[,"Priority"] %in% c("base", "recommended")), 1]

This way you select all installed packages that do not ship with R (as
base or recommended ones).

Uwe Ligges





> sapply(pkgs.to.remove, uninstall.packages, lib=path.lib)
>
> Best regards,
> Janko
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Reset R's library to base packages only (remove all installed contributed packages)

Janko Thyson-2
On 14.06.2011 13:34, Uwe Ligges wrote:

>
>
> On 14.06.2011 12:04, Janko Thyson wrote:
>> Dear list,
>>
>> is there a way to comfortably "reset" R's library such that it only
>> contains only the base packages again? In other words, how can I
>> uninstall all contributed packages that I installed? Is there some sort
>> of index that's keeping track of what has been installed? If so, a
>> pointer would be great.
>>
>> AFAIU, if you don't create such an "index file" yourself and loose track
>> of what you installed, probably the best way to "reset" R is to actually
>> re-install it. That's exactly what I'm trying to avoid.
>>
>> I would like something like
>>
>> path.lib <- "path/to/R/lib"
>> pkgs.to.remove <- readLines(path.to.index.file)
>
> ip <- installed.packages()
> pkgs.to.remove <- ip[!(ip[,"Priority"] %in% c("base", "recommended")), 1]
>
> This way you select all installed packages that do not ship with R (as
> base or recommended ones).
>
> Uwe Ligges
>
>
Great, thanks!

>
>
>
>> sapply(pkgs.to.remove, uninstall.packages, lib=path.lib)
>>
>> Best regards,
>> Janko
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.