Displaying 20 results from an estimated 10000 matches similar to: "Digest package - make digest generic?"
2007 Dec 10
4
Reading through a group of .RData files
Hi.
 
I have a procedure that reads a directory, loops through a set of particular .RData files, loading each one, and feeding its object(s) into a function, as follows:
 
cvListFiles<-list.files(fnDir);
for(i in grep(paste("^",pfnStub,".*\\.RData$",sep=""),cvListFiles)){
load(paste(fnDir,cvListFiles[i],sep="/"));
myFunction(rliObject);
rm(rliObject);
};
2009 Jul 15
1
loading multiple .Rdata and preserving variable names
Dear R-users,
I need to load outputs from multiple previous calculations into one R
session for comparison and (cross-)analysis. The previous calculations are
stored in different directories in .Rdata files (I don't know if this is the
best storage for later usage, but the previous project could be recalculated
and saved into different format, if needed, potentially.)
I can load consequently
2018 Aug 25
4
Where does L come from?
Hi all,
Would someone mind pointing to me to the inspiration for the use of
the L suffix to mean "integer"?  This is obviously hard to google for,
and the R language definition
(https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Constants)
is silent.
Hadley
-- 
http://hadley.nz
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
On Fri, Mar 3, 2017 at 9:55 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>> But, how you propose a warning-to-error transition should be made
>> without wreaking havoc?  Just flip the switch in R-devel and see CRAN
>> and Bioconductor packages break overnight?  Particularly Bioconductor
>> devel might become non-functional (since at times it requires
>>
2018 May 08
5
download.file does not process gz files correctly (truncates them?)
On Thu, May 3, 2018 at 11:34 PM, Tomas Kalibera
<tomas.kalibera at gmail.com> wrote:
> On 05/03/2018 11:14 PM, Henrik Bengtsson wrote:
>>
>> Also, as mentioned in my
>> https://stat.ethz.ch/pipermail/r-devel/2012-August/064739.html, when
>> not specifying the mode argument, the default on Windows is mode = "w"
>> *except* for certain,
2006 Mar 07
3
Making an S3 object act like a data.frame
"[.ggobiDataset" <- function(x, ..., drop=FALSE) {
	x <- as.data.frame(x)
	NextMethod("[", x)
}
"[[.ggobiDataset" <- function(x, ..., drop=FALSE) {
	x <- as.data.frame(x)
	NextMethod("[[", x)
}
"$.ggobiDataset" <- function(x, ..., drop=FALSE) {
	x <- as.data.frame(x)
	NextMethod("$", x)
}
> class(x)
[1]
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 04
3
Control statements with condition with greater than one should give error (not just warning) [PATCH]
Is there really a need for these complications? Packages emitting this
warning are broken by definition and should be fixed. Perhaps we could
"flip the switch" in a test environment and see how much havoc is wreaked
and whether authors are sufficiently responsive?
Michael
On Sat, Mar 4, 2017 at 12:04 PM, Martin Maechler <maechler at stat.math.ethz.ch
> wrote:
>
2015 Oct 13
1
A where() functions that does what exists() does but return the environment when object lives?
On Tue, Oct 13, 2015 at 4:43 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
> Seems easy enough to write yourself:
>
> where <- function(x, env = parent.frame()) {
>     if (identical(env, emptyenv()))
>         return(NULL)
>     if (exists(x, envir = env, inherits = FALSE))
>         return(env)
>     where(x, parent.env(env))
> }
>
> sample2 <-
2006 May 25
1
save() saves extra stuff if object is not evaluated
Hi,
it looks like save() is saving all contents of the calling
environments if the object to be saved is *not* evaluated, although it
is not that simple either.  After many hours of troubleshooting, I'm
still confused.  Here is a reproducible example (also attached) with
output.  I let the code and the output talk for itself:
peek <- function(file, from=1, to=500) {
 
2008 Jan 29
2
A "safe" do.call
Has anyone developed a version of do.call that is safe in the sense
that it silently drops parameters that do not appear in the formals of
the called function? This is useful when ... ends up being used in
multiple further functions.  e.g.
f <- function(a, b) {a + b}
do.call(f, list(a=1, b=2, c=3))  # Errors
safe.call(f, list(a=1, b=2, c=3)) # Returns 3
If have quickly thrown together the
2007 Sep 28
6
Graphics and LaTeX documents with the same font
Dear All,
I know how to export graphics as pdf files and then how to include
them in LaTeX documents. However, I do not know how to do in order to
have the text of the graphics written with the font selected for the
LaTeX document. Is that possible?
Thanks in advance,
Paul
2018 Aug 25
2
Where does L come from?
Not that it brings closure, but there's also
https://stat.ethz.ch/pipermail/r-devel/2017-June/074462.html
Henrik
On Sat, Aug 25, 2018, 06:40 Marc Schwartz via R-devel <r-devel at r-project.org>
wrote:
> On Aug 25, 2018, at 9:26 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
> >
> > Hi all,
> >
> > Would someone mind pointing to me to the
2015 May 26
4
MetaCran website v1.0.0-alpha
On Tue, May 26, 2015 at 12:18 PM, Gabriel Becker <gmbecker at ucdavis.edu> wrote:
> On Tue, May 26, 2015 at 9:25 AM, Yihui Xie <xie at yihui.name> wrote:
>
>> I cannot speak for other package authors, but for all my own packages,
>> I have provided the BugReports field in DESCRIPTION that points to the
>> Github issues page. You can probably use this field to
2015 Jan 26
2
Inspect a "delayed" assigned whose value throws an error?
On Mon, Jan 26, 2015 at 12:24 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
> If it was any other environment than the global, you could use substitute:
>
> e <- new.env()
> delayedAssign("foo", stop("Hey!"), assign.env = e)
> substitute(foo, e)
>
> delayedAssign("foo", stop("Hey!"))
> substitute(foo)
Hmm... interesting
2010 Aug 24
2
Comparing/diffing strings
Hi all,
all.equal is generally very useful when you want to find the
differences between two objects.  It breaks down however, when you
have two long strings to compare:
> all.equal(a, b)
[1] "1 string mismatch"
Does any one know of any good text diffing tools implemented in R?
Thanks,
Hadley
-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice
2007 Feb 25
8
Double-banger function names: preferences and suggestions
What do you prefer/recommend for double-banger function names:
 1 scale.colour
 2 scale_colour
 3 scaleColour
1 is more R-like, but conflicts with S3.  2 is a modern version of
number 1, but not many packages use it.  Number 3 is more java-like.
(I like number 2 best)
Any suggestions?
Thanks,
Hadley
2015 Oct 09
4
A where() functions that does what exists() does but return the environment when object lives?
Hi,
exists("foo", inherits=TRUE) check whether an object named "foo"
exists, and get("foo", inherits=TRUE) retrieves it.  I'm looking for a
similar function to exists() that returns the environment where the
object "foo" exists, iff at all.  If not found, NULL is returned.
Does that exist?
EXAMPLE #1:
> sample2 <- base::sample
> env <-
2016 Aug 15
2
ifelse() woes ... can we agree on a ifelse2() ?
On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>>     >> One possibility would also be to consider  a "numbers-only" or
>>     >> rather "same type"-only {e.g., would also work for characters}
>>     >> version.
>>
>>     > I don't know what you mean by these.
>>
>> In the
2018 Jun 08
6
Subsetting the "ROW"s of an object
Hi all,
Is there a better to way to subset the ROWs (in the sense of NROW) of
an vector, matrix, data frame or array than this?
subset_ROW <- function(x, i) {
  nd <- length(dim(x))
  if (nd <= 1L) {
    x[i]
  } else {
    dims <- rep(list(quote(expr = )), nd - 1L)
    do.call(`[`, c(list(quote(x), quote(i)), dims, list(drop = FALSE)))
  }
}
subset_ROW(1:10, 4:6)
#> [1] 4 5 6
2004 Jul 16
3
Strange (non-deterministic) problem with strsplit
I'm having an odd problem with strsplit (well I think it's strplit
that's causing the problem).  When I run the code below as follows:
 str(parseFormulaMin(y +x +d ~ b +d +e| a * b))
I expect to get
List of 3
 $ y: chr "y+x+d"
 $ x: chr "b+d+e"
 $ g: chr "a*b"
But about half the time I get 
List of 3
 $ y: chr "y+x+d"
 $ x: chr