Displaying 20 results from an estimated 10000 matches similar to: "namespace? environment? how to manage functions?"
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
[Env: Win XP, R 2.14.2, R 2.15.0]
I have a replacement function for setwd() in my .Rprofile which displays
the current R path in the R window
title. It no longer works in R 2.15.x, giving the error below. Worse,
the error prevents the rest of my
.Rprofile script from completing.
Is there some way to rescue this, i.e., preserve this behavior in
R 2.15? If not, how can I modify my script so it
2010 May 27
1
Rprofile: distinguish between Rgui, Rterm, JGR?
[Environment: Win XP, R 2.10.1]
In my Rprofile I have startup code to do various things, intended for
when I use the Rgui console.
Some of these are causing problems in JGR now that I've installed it.
How can I test for R
running with Rgui to do some of these things only there?
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University
2015 Jul 28
2
Installing/updating packages on a lab network
I'm the faculty member in my department who advises our IT staff on the
details of installing R for
students and faculty on our Windows 7 lab network. We are about to
upgrade from R 3.1.1 to
R 3.2.1, and once that is done, this version of R and all installed
packages will be frozen in the
image that appears in C:/Program Files/R/R-3.2.1/ on every lab computer,
and this image is
refreshed
2015 Jul 29
1
Installing/updating packages on a lab network
On 7/28/2015 1:32 PM, Uwe Ligges wrote:
> Just add the line
>
> R_LIBS_SITE=F:/R/library
>
> to the file R_HOME/etc/x64/Renviron.site
Thanks, Uwe
I have no way to test this and our IT people who do the installation
know nothing of R, so follow-up questions:
* There is no R_HOME/etc/x64/Renviron.site file, but there is a
R_HOME/etc/Rprofile.site I can modify and
ask them to
2013 Feb 07
1
assignInNamespace to create a setwd() replacement: how to use unlockBinding()?
In my .Rprofile for Windows, I had the following functions defined to
mirror a few features
I miss from linux:
(a) replace setwd() with a version that stashes the current directory so
it can be easily restored
(b) writes a short version of the current R directory to the Windows
title bar: I can always see where I am,
with multiple Rgui windows.
(c) creates a cd() shorthand for setwd(), but
2012 Oct 30
1
print and execute functions in a package namespace
Let's say I have a package that consists of a set of functions, fig1(),
fig2(), fig3() ..., each of which
produces a plot, and perhaps some printed output, e.g.,
fig1 <- function() plot(1:10)
fig2 <- function() plot(10:1)
fig3 <- function() {y<-sample(1:10,10); plot(y); y}
I'd like to produce a document (PDF or HTML) containing the listing of
each function and its output,
2011 Nov 08
2
NAMESPACES for data only packages
the NEWS file for R-devel says
*
Even data-only packages without *R* code need a namespace and so may
need to be installed under *R* 2.14.0 or later.
but what should this contain? Can it simply be an empty NAMESPACE
file? I assume that data does not have to
be exported.
-Michael
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University
2020 Oct 22
0
vanilla session in R Gui or RStudio
Have you looked into your .Rprofile file? Loading packages is not something R normally does without your telling it to do so, but many people forget that they have done so.
On October 22, 2020 3:47:04 PM PDT, Michael L Friendly <friendly at yorku.ca> wrote:
>[env: Windows, R 3.6.6]
>
>When I start R from the R Gui icon or from RStudio, I get a large
>number of packages loaded
2020 Oct 22
2
vanilla session in R Gui or RStudio
[env: Windows, R 3.6.6]
When I start R from the R Gui icon or from RStudio, I get a large number of packages loaded via a namespace. Not entirely clear where these come from.
As a result, I often run into problems updating packages because something is already loaded. How can start a new gui session with minimal packages loaded?
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform:
2010 Feb 01
2
hiding/protecting utility functions in .Rprofile
[Env: WinXp, R 2.9.2]
In my .Rprofile, I define a number of utility functions I'd like to have
available in my R session, but don't want them
to be *normally* listed by ls(), or more importantly, saved if I save my
session variables/functions.
How can I do this?
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416
2010 Nov 25
1
Request: kronecker to get a sep= argument
kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line
tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":")
For an application in which dimnames arise from an n-way array, where
different dimensions have
different roles, and I would like to be able to use kronecker in the form
kronecker(A, B, make.dimnames=TRUE,
2010 Nov 29
2
R equivalent of Beaton's Sweep algorithm
I'm looking for an R equivalent of Beaton's (1964) Sweep algorithim for
partial inversion of a
matrix by pivoting.
It implemented in SAS/IML as sweep(matrix, indices), described here
http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/langref_sect266.htm
and here for python
http://adorio-research.org/wordpress/?p=262
--
Michael Friendly Email: friendly AT yorku
2011 May 16
1
dir.choose analog of file.choose
Under Windows (and maybe others) you can use file.choose() as a
substitute for an explicit file=
argument in most places.
Is there an analog for what I'll call dir.choose(), so that I can say
setwd(dir.choose())
thx,
-Michael
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele
2011 Nov 29
2
format numbers without leading or trailing 0s
A simple question, but I can't find something to do what I want:
Given: a vector of numbers, like
lambda <- c(0, 0.005, 0.01, 0.02, 0.04, 0.08)
Desired: format them in minimal space for use as plot labels, ie,
without leading or tailing 0s. For this example:
lambdaf <- c("0", .005", ".01", ".02", ".04", ".08")
--
Michael
2011 Oct 12
1
NOTE: unstated dependencies in examples
Using R 2.13.1, I am now getting the following NOTE when I run R CMD
check on my HistData
package
* checking for unstated dependencies in examples ... NOTE
'library' or 'require' calls not declared from:
gplots sp
Under R 2.12.x, I didn't get these notes.
I have ~ 25 .Rd files in this package, and AFAICS, every example uses
library or require for the
functions used;
2020 Oct 23
0
vanilla session in R Gui or RStudio
Can you be more specific about what conditions cause R to automatically load a package when a .RData file is loaded? My experience has actually been the opposite.
On October 22, 2020 6:13:11 PM PDT, Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote:
>As Jeff says, it might be that you have a ~/.Rprofile file with
>instructions to load packages when R starts. It could also be
2007 Sep 29
2
resetting par() to all defaults: par(reset=TRUE) ?
In a long session, producing multiple graphs, I sometimes repeatedly
change par() settings, particularly with multi-row/col displays.
If I'm using a script, I'll do
op <- par(newsettings)
... plots ...
par(op)
but sometimes I do things on the fly and can't easily back out
to the default settings. I'm looking for someway to do the
equivalent of
par(reset=TRUE)
I suppose I
2011 Apr 08
0
Consistency of messages from R CMD {check,build,install}
A minor gripe/request: Could all R CMD package tools not at the very
least be consistent in indicating when
they are done, as in
* DONE (packagename)
or at least
* DONE
R CMD build leaves one hanging, not knowing whether it has completed or
it is time to get another coffee.
* checking for file 'C:/Documents/workspace/heplots/DESCRIPTION' ... OK
* preparing 'heplots':
*
2011 Aug 22
0
CRAN packages maintained by you
It is A Good Thing to regularize Authors and Maintainers of packages,
particularly for citation()
and toBibTex().
Could I add a suggested TODO item for the maintainer of package.skeleton
and friends to
help reinforce this for new packages:
- Please add appropriate templates for Author at R in the skeleton
DESCRIPTION file generated,
indicating the proper format as well as the use of role= to
2010 Nov 19
0
printCoefmat() for a data.frame with factors
I want to use something like printCoefmat() in a print.summary method to
print a more nicely formatted version
of the result from a summary method, but where the estimates may be
cross-classified by one or more factors.
However, printCoefmat() assumes that the labels for the parameters are
the rownames of the object, and
prints factors as integers. With one factor, I could just assign that as