similar to: Is NULL a vector?

Displaying 20 results from an estimated 30000 matches similar to: "Is NULL a vector?"

2018 Jul 23
0
Is NULL a vector?
On 23/07/2018 3:03 PM, Hadley Wickham wrote: > Hi all, > > Would you generally consider NULL to be a vector? According to the language definition (in the doc directory), it is not: "Vectors can be thought of as contiguous cells containing data. Cells are accessed through indexing operations such as x[5]. More details are given in Indexing. R has six basic (?atomic?) vector
2018 Aug 08
2
vctrs: a type system for the tidyverse
Hadley, Responses inline. On Wed, Aug 8, 2018 at 7:34 AM, Hadley Wickham <h.wickham at gmail.com> wrote: > >>> Method dispatch for `vec_c()` is quite simple because associativity and > >>> commutativity mean that we can determine the output type only by > >>> considering a pair of inputs at a time. To this end, vctrs provides > >>>
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
2004 Oct 07
5
Subset doesn't drop unused factor levels
a <- data.frame(b = rep(1:5, each=2), c=factor(rep("a",10), levels=c("a","b"))) levels(subset(a, b=1, drop=T)$c) # [1] "a" "b" Is this a bug? Thanks,, Hadley
2018 Aug 06
3
vctrs: a type system for the tidyverse
> First off, you are using the word "type" throughout this email; You seem to > mean class (judging by your Date and factor examples, and the fact you > mention S3 dispatch) as opposed to type in the sense of what is returned by > R's typeof() function. I think it would be clearer if you called it class > throughout unless that isn't actually what you mean (in
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
2016 Aug 05
1
What happened to Ross Ihaka's proposal for a Common Lisp based R successor?
But you can easily fall back to R from within Julia; see http://juliastats.github.io/RCall.jl/latest/ On Aug 5, 2016 1:27 PM, "Hadley Wickham" <h.wickham at gmail.com> wrote: > No. > > Hadley > > On Fri, Aug 5, 2016 at 11:12 AM, Kenny Bell <kmbell56 at gmail.com> wrote: > > Is it conceivable that Julia could be ported to use R syntax in a way > that
2013 Oct 21
1
Set operation generics
Hi all, Would anyone be interested in reviewing a patch to make the set operations (union, intersect, setdiff, setequal, is.element) generic? Thanks, Hadley -- Chief Scientist, RStudio http://had.co.nz/
2016 Aug 05
2
What happened to Ross Ihaka's proposal for a Common Lisp based R successor?
Is it conceivable that Julia could be ported to use R syntax in a way that would allow the vastly larger numbers of R programmers to seamlessly switch? Or equivalently, could an iteration of R itself do this? On Fri, Aug 5, 2016, 9:00 AM Hadley Wickham <h.wickham at gmail.com> wrote: > When it was being actively worked on, it had the advantage of existing. > > Hadley > > On
2006 Sep 18
2
Help for methods
Help for help says: The 'topic' argument may also be a function call, to ask for documentation on a corresponding method. See the section on method documentation. and The authors of formal ('S4') methods can provide documentation on specific methods, as well as overall documentation on the methods of a particular function. The
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
2018 Jun 08
2
Subsetting the "ROW"s of an object
I suspect this will have suboptimal performance since the TRUEs will get recycled. (Maybe there is, or could be, ALTREP, support for recycling) Hadley On Fri, Jun 8, 2018 at 10:16 AM, Berry, Charles <ccberry at ucsd.edu> wrote: > > >> On Jun 8, 2018, at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote: >> >> Hi all, >> >> Is there a better to
2016 Mar 01
2
Data frame printing buglet when multiple empty column names
This is admittedly minor, and you shouldn't have repeated names in a data frame anyway, but: df <- data.frame(1:3, 1:3, 1:3) # Ok setNames(df, c("x", "y", "")) # Not ok setNames(df, c("x", "", "")) Hadley -- http://hadley.nz
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
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 <-
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
2018 Jun 08
4
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham <h.wickham at gmail.com> wrote: > > On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote: >> >> >>> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote: >>> >>> Also the TRUEs cause problems if some dimensions are 0: >>>
2015 Mar 30
1
Segfault with match()
I left out the warning - it's still there. The output object is malformed but either +.factor should prevent this or match() should check. Hadley On Mon, Mar 30, 2015 at 3:50 PM, William Dunlap <wdunlap at tibco.com> wrote: > Did you leave out the warning from "+", which should be an error, > as it produces an illegal ordered factor in this case and factor+factor >
2018 Aug 23
7
conflicted: an alternative conflict resolution strategy
Hi all, I?d love to get your feedback on the conflicted package, which provides an alternative strategy for resolving ambiugous function names (i.e. when multiple packages provide identically named functions). conflicted 0.1.0 is already on CRAN, but I?m currently preparing a revision (<https://github.com/r-lib/conflicted>), and looking for feedback. As you are no doubt aware, R?s default
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