[R] Setting bioconductor repository in .Rprofile. Is there a permanent way?

2011-01-24 Thread Kevin Wright
I currently set the Bioconductor repository in my .Rprofile using this
code (which needs editing for every version number change of
Bioconductor):

# Choose repositories
repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
 CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
 BioCsoft=http://www.bioconductor.org/packages/2.7/bioc;,
 Rforge=http://r-forge.r-project.org;))
options(repos=repos)
rm(repos)

I'd like to avoid editing the version number.  One hack to do so is
this code that adds all repositories.

setRepositories(ind=1:10)
r - getOption(repos)
r - r[!is.na(r)]
options(repos=r)

Is there a simpler way?  I've searched for quite a while without
finding an answer.


Incidentally, the help page for options says:
A Bioconductor mirror can be selected by setting
options(BioC_mirror): the default value is
http://www.bioconductor.org;.
The word default is a bit confusing here, because when I start R, I see:

R options()$BioC_mirror
NULL


-- 
Kevin Wright

__
R-help@r-project.org 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.


Re: [R] Setting bioconductor repository in .Rprofile. Is there a permanent way?

2011-01-24 Thread Martin Morgan
On 01/24/2011 10:45 AM, Kevin Wright wrote:
 I currently set the Bioconductor repository in my .Rprofile using this
 code (which needs editing for every version number change of
 Bioconductor):
 
 # Choose repositories
 repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
  CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
  BioCsoft=http://www.bioconductor.org/packages/2.7/bioc;,
  Rforge=http://r-forge.r-project.org;))
 options(repos=repos)
 rm(repos)
 
 I'd like to avoid editing the version number.  One hack to do so is
 this code that adds all repositories.
 
 setRepositories(ind=1:10)
 r - getOption(repos)
 r - r[!is.na(r)]
 options(repos=r)
 
 Is there a simpler way?  I've searched for quite a while without
 finding an answer.
 
 
 Incidentally, the help page for options says:
 A Bioconductor mirror can be selected by setting
 options(BioC_mirror): the default value is
 http://www.bioconductor.org;.
 The word default is a bit confusing here, because when I start R, I see:

one possibility is to

  source('http://bioconductor.org/biocLite.R')

in .Rprofile, after which biocinstallRepos() provides the correct bioc
repositories for the version of R in use; it does clutter the .GlobalEnv
a little and would be irritating if, e.g., on a laptop,  internet access
were slow or not reliable. For the latter I wrote

makeActiveBinding(biocLite, local({
env - new.env()
function() {
if (!exists(biocLite, envir=env, inherits=FALSE)) {
evalq(source(http://bioconductor.org/biocLite.R;,
 local=TRUE),
  env)
}
env[[biocLite]]
}
}), .GlobalEnv)

which doesn't make the connection until one accesses the biocLite variable.

Martin

 
 R options()$BioC_mirror
 NULL
 
 


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

__
R-help@r-project.org 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.


Re: [R] Setting bioconductor repository in .Rprofile. Is there a permanent way?

2011-01-24 Thread Kevin Wright
Of course, before posting my question, I did RTFM and RTFcode and
RTFmailinglists.  The key word in my question was simpler.  I
rejected copying a modified version of the repositories file to my
home directory since it has changed numerous times with addition of
R-forge etc.

Here is another option.  More lines of code, but doesn't add unneeded
repositories.

pp - file.path(R.home(etc), repositories)
rr - tools:::.read_repositories(pp)
repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
BioCsoft=rr[BioCsoft,URL],
Rforge=http://r-forge.r-project.org;))
options(repos=repos)
rm(pp, rr, repos)


Martin, I appreciated your clever trick of evaluating on demand.

Kevin


On Mon, Jan 24, 2011 at 12:45 PM, Kevin Wright kw.s...@gmail.com wrote:
 I currently set the Bioconductor repository in my .Rprofile using this
 code (which needs editing for every version number change of
 Bioconductor):

 # Choose repositories
 repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
                     CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
                     BioCsoft=http://www.bioconductor.org/packages/2.7/bioc;,
                     Rforge=http://r-forge.r-project.org;))
 options(repos=repos)
 rm(repos)

 I'd like to avoid editing the version number.  One hack to do so is
 this code that adds all repositories.

 setRepositories(ind=1:10)
 r - getOption(repos)
 r - r[!is.na(r)]
 options(repos=r)

 Is there a simpler way?  I've searched for quite a while without
 finding an answer.


 Incidentally, the help page for options says:
 A Bioconductor mirror can be selected by setting
 options(BioC_mirror): the default value is
 http://www.bioconductor.org;.
 The word default is a bit confusing here, because when I start R, I see:

 R options()$BioC_mirror
 NULL


 --
 Kevin Wright




-- 
Kevin Wright

__
R-help@r-project.org 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.


Re: [R] Setting bioconductor repository in .Rprofile. Is there a permanent way?

2011-01-24 Thread Henrik Bengtsson
It is easier than that.  Use

http://www.bioconductor.org/packages/release/bioc

or

http://www.bioconductor.org/packages/devel/bioc

/Henrik

On Mon, Jan 24, 2011 at 10:56 AM, Martin Morgan mtmor...@fhcrc.org wrote:
 On 01/24/2011 10:45 AM, Kevin Wright wrote:
 I currently set the Bioconductor repository in my .Rprofile using this
 code (which needs editing for every version number change of
 Bioconductor):

 # Choose repositories
 repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
                      CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
                      
 BioCsoft=http://www.bioconductor.org/packages/2.7/bioc;,
                      Rforge=http://r-forge.r-project.org;))
 options(repos=repos)
 rm(repos)

 I'd like to avoid editing the version number.  One hack to do so is
 this code that adds all repositories.

 setRepositories(ind=1:10)
 r - getOption(repos)
 r - r[!is.na(r)]
 options(repos=r)

 Is there a simpler way?  I've searched for quite a while without
 finding an answer.


 Incidentally, the help page for options says:
 A Bioconductor mirror can be selected by setting
 options(BioC_mirror): the default value is
 http://www.bioconductor.org;.
 The word default is a bit confusing here, because when I start R, I see:

 one possibility is to

  source('http://bioconductor.org/biocLite.R')

 in .Rprofile, after which biocinstallRepos() provides the correct bioc
 repositories for the version of R in use; it does clutter the .GlobalEnv
 a little and would be irritating if, e.g., on a laptop,  internet access
 were slow or not reliable. For the latter I wrote

 makeActiveBinding(biocLite, local({
    env - new.env()
    function() {
        if (!exists(biocLite, envir=env, inherits=FALSE)) {
            evalq(source(http://bioconductor.org/biocLite.R;,
                         local=TRUE),
                  env)
        }
        env[[biocLite]]
    }
 }), .GlobalEnv)

 which doesn't make the connection until one accesses the biocLite variable.

 Martin


 R options()$BioC_mirror
 NULL




 --
 Computational Biology
 Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

 Location: M1-B861
 Telephone: 206 667-2793

 __
 R-help@r-project.org 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.


__
R-help@r-project.org 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.


Re: [R] Setting bioconductor repository in .Rprofile. Is there a permanent way?

2011-01-24 Thread Kevin Wright
Now that is _simple_.  Thanks.

Kevin


On Mon, Jan 24, 2011 at 1:49 PM, Kevin Wright kw.s...@gmail.com wrote:
 Of course, before posting my question, I did RTFM and RTFcode and
 RTFmailinglists.  The key word in my question was simpler.  I
 rejected copying a modified version of the repositories file to my
 home directory since it has changed numerous times with addition of
 R-forge etc.

 Here is another option.  More lines of code, but doesn't add unneeded
 repositories.

 pp - file.path(R.home(etc), repositories)
 rr - tools:::.read_repositories(pp)
 repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
                    CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
                    BioCsoft=rr[BioCsoft,URL],
                    Rforge=http://r-forge.r-project.org;))
 options(repos=repos)
 rm(pp, rr, repos)


 Martin, I appreciated your clever trick of evaluating on demand.

 Kevin


 On Mon, Jan 24, 2011 at 12:45 PM, Kevin Wright kw.s...@gmail.com wrote:
 I currently set the Bioconductor repository in my .Rprofile using this
 code (which needs editing for every version number change of
 Bioconductor):

 # Choose repositories
 repos - structure(c(CRAN=http://streaming.stat.iastate.edu/CRAN;,
                     CRANextra=http://www.stats.ox.ac.uk/pub/RWin;,
                     BioCsoft=http://www.bioconductor.org/packages/2.7/bioc;,
                     Rforge=http://r-forge.r-project.org;))
 options(repos=repos)
 rm(repos)

 I'd like to avoid editing the version number.  One hack to do so is
 this code that adds all repositories.

 setRepositories(ind=1:10)
 r - getOption(repos)
 r - r[!is.na(r)]
 options(repos=r)

 Is there a simpler way?  I've searched for quite a while without
 finding an answer.


 Incidentally, the help page for options says:
 A Bioconductor mirror can be selected by setting
 options(BioC_mirror): the default value is
 http://www.bioconductor.org;.
 The word default is a bit confusing here, because when I start R, I see:

 R options()$BioC_mirror
 NULL


 --
 Kevin Wright




 --
 Kevin Wright




-- 
Kevin Wright

__
R-help@r-project.org 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.