similar to: Help for methods

Displaying 20 results from an estimated 20000 matches similar to: "Help for methods"

2006 May 10
2
Warning: use of NULL environment is deprecated (in R CMD check)
* checking S3 generic/method consistency ... WARNING Warning: use of NULL environment is deprecated Warning: use of NULL environment is deprecated See section 'Generic functions and methods' of the 'Writing R Extensions' manual. I don't get any other warnings or errors. Can anyone suggest what the problem might be? (R2.3.0, OS X) Thanks, Hadley
2006 Sep 03
2
lm, weights and ...
> lm2 <- function(...) lm(...) > lm2(mpg ~ wt, data=mtcars) Call: lm(formula = ..1, data = ..2) Coefficients: (Intercept) wt 37.285 -5.344 > lm2(mpg ~ wt, weights=cyl, data=mtcars) Error in eval(expr, envir, enclos) : ..2 used in an incorrect context, no ... to look in Can anyone explain why this is happening? (Obviously this is a manufactured example, but it
2009 Jan 07
1
Fw: Re: R Stacked Histogram
Hi Jason, > Well, one last questions about stack plot (please forgive the lame example > below). I thought the below allow me to resize the the "title" of the > stacked histogram, but no luck. Any suggestions as to the modificaiton > necessary to get it to work? Right now the title is obscured by the plot > and my boss will be none too happy. Thanks again. Yes,
2007 May 12
2
Implicit vs explicit printing and the call stack
Hi everyone, I've run into a bit of strange problem with implicit vs explicit printing and the call stack. I've included an example at the bottom of this email. The basic problem is that I have an S3 object with a print method. When the object is implicitly printed (ie. typed directly into the console) the function arguments in the call stack are exploded out to their actual values,
2006 Feb 21
4
do.call, browser and traceback
A problem that I've encountered when using do.call a lot is very large stack traces, eg: f <- function(x) stop() do.call(error, mtcars) traceback() f <- function(x) browser() do.call(f, mtcars) I have hacked together my own version of traceback to fix this by limiting the length of each line to 80 characters, but I can't see any way to do something similar for browser. Any
2012 Jan 06
1
seq_along and rep_along
Hi all, A couple of ideas for improving seq_along: * It would be really useful to have a second argument dim: seq_along(mtcars, 1) seq_along(mtcars, 2) # equivalent to seq_len(dim(mtcars)[1]) seq_len(dim(mtcars)[2]) I often find myself wanting to iterate over the rows or column of a data frame, and there isn't a particularly nice idiom if you want to avoid problems
2017 Mar 19
3
RFC: (in-principle) native unquoting for standard evaluation
Would this return a quosure? (i.e. a single sided formula that captures both expression and environment). That's the data structure we've adopted in tidyeval as it already has some built in support. Hadley On Friday, March 17, 2017, Michael Lawrence <lawrence.michael at gene.com> wrote: > Interesting idea. Lazy and non-standard evaluation is going to happen; the > language
2007 Nov 20
1
plotting confidence intervals of regression line
Hello, I am trying to generate a confidence interval (90 or 95%) of a regression line. This is primarily just for illustration on a scatter plot (i.e. I am trying to make this http://www.ast.cam.ac.uk/~rgm/scratch/statsbook/graphics/anima4.gif). I have been trying to use the predict.lm function, with interval set as "confidence", but this still seems to be giving me a prediction
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
2008 Dec 02
4
Bug in "transform"?
Dear useRs, Here is a weird behavior of transform function: mtcars1<-matcars transform(mtcars1,t1=3,t2=4) Error in data.frame(`_data`, e[!matched]) : arguments imply differing number of rows: 32, 1 instead, this works: mtcars1$t1<-0 transform(mtcars1,t1=3,t2=4) also works if applied in turn: transform(mtcars1,t1=3) transform(mtcars1,t2=4) I often need to use this
2007 Sep 08
1
ggplot legend consolidation
Hello Everyone, I have recently been introduced to the ggplot package by Hadley Wickham and must say I am quite impressed so far at how easy it is to make attractive plots, but one thing I am struggling over is how to consolidate legends. I have 3 plots that I would like to put on a single page and all 3 map the same dimension of the data to the colour aesthetic. Right now, when I plot all
2011 Oct 18
9
readRDS and saveRDS
Hi all, Is there any chance that readRDS and saveRDS might one day become read.rds and write.rds? That would make them more consistent with the other reading and writing functions. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2013 Oct 30
2
Huge performance difference between implicit and explicit print
Hi all, Can anyone help me understand why an implicit print (i.e. just typing df at the console), is so much slower than an explicit print (i.e. print(df)) in the example below? I see the difference in both Rstudio and in a terminal. # Construct large df as quickly as possible dummy <- 1:18e6 df <- lapply(1:10, function(x) dummy) names(df) <- letters[1:10] class(df) <-
2007 Oct 01
4
how to plot a graph with different pch
I am trying to plot a graph but the points on the graph should be different symbols and colors. It should represent what is in the legend. I tried using the points command but this does not work. Is there another command in R that would allow me to use different symbols and colors for the points? Thank you kindly. data(mtcars) plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)",
2007 Oct 15
2
Digest package - make digest generic?
On 10/15/07, Henrik Bengtsson <hb at maths.lth.se> wrote: > [As agreed, CC:ing r-devel since others might be interested in this as well.] > > Hi. > > On 10/15/07, Dirk Eddelbuettel <edd at debian.org> wrote: > > > > Hi Hadley, > > > > On 15 October 2007 at 09:51, hadley wickham wrote: > > | Would you consider making digest a generic
2018 Jul 07
6
Testing for vectors
On Sat, Jul 7, 2018 at 1:50 PM, Gabe Becker <becker.gabe at gene.com> wrote: > Hadley, > >> >> I was thinking primarily of completing the set of is.matrix() and >> is.array(), or generally, how do you say: is `x` a 1d dimensional >> thing? > > > Can you clarify what you mean by dimensionality sense and specifically 1d > here? What do we call a
2017 Aug 08
0
Inheritance for S3 classes
You might find http://adv-r.hadley.nz/s3.html to be helpful (in particular, http://adv-r.hadley.nz/s3.html#constructors-1, gives my advice about subclass constructors) Hadley On Mon, Aug 7, 2017 at 7:06 PM, Kym Nitschke <kym.nitschke at icloud.com> wrote: > Hi R Users, > > I am relatively new to programming in R ? so I apologise if my questions appear ?dumb?. > > I am using
2013 Jun 19
2
str and s3 classes
Hi all, Because str uses the generic version of length and names, it's currently very easy to create objects that break str: a <- structure(list(1:5), class = "a") length.a <- function(x) 2L str(a) b <- structure(list(1:5), class = "b") names.b <- function(x) character() str(b) These are obvious toy examples, but it is a real problem if you want to create
2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
Same thing happens with S3 if you redefine print(). I thought that code was actually calculating the function to call rather than the symbol to use, but apparently not. Shouldn't be too hard to fix. luke On Tue, 30 Jun 2015, Hadley Wickham wrote: > On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch > <murdoch.duncan at gmail.com> wrote: >> On 30/06/2015 1:57 PM, Hadley
2007 Apr 16
2
Plotting data with a fitted curve
Suppose you have a vector of data in x and response values in y. How do you plot together both the points (x,y) and the curve that results from the fitted model, if the model is not y ~ x, but a higher order polynomial, e.g. y~poly(x,2)? (In other words, abline doesn't work for this case.) Thanks, --Paul -- Paul Lynch Aquilent, Inc. National Library of Medicine (Contractor)