Displaying 20 results from an estimated 20000 matches similar to: "clearNames and unname"
2018 Apr 27
5
predict.glm returns different results for the same model
Hi all,
Very surprising (to me!) and mystifying result from predict.glm(): the
predictions vary depending on whether or not I use ns() or
splines::ns(). Reprex follows:
library(splines)
set.seed(12345)
dat <- data.frame(claim = rbinom(1000, 1, 0.5))
mns <- c(3.4, 3.6)
sds <- c(0.24, 0.35)
dat$wind <- exp(rnorm(nrow(dat), mean = mns[dat$claim + 1], sd =
sds[dat$claim + 1]))
dat <-
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/
2010 Feb 08
5
Fast way to determine number of lines in a file
Hi all,
Is there a fast way to determine the number of lines in a file? I'm
looking for something like count.lines analogous to count.fields.
Hadley
--
http://had.co.nz/
2011 May 04
4
Recursive objects
Hi all,
Does anyone have a comprehensive list of recursive-type objects in R?
is.recursive defines them as by exclusion: "most types of objects are
regarded as recursive, except for vector types, ?NULL? and symbols
(as given by ?as.name?)." I think this that means recursive objects
are:
* lists
* pairlists
* calls
* expressions
Did I miss anything?
Hadley
--
Assistant
2011 Dec 31
4
Base function for flipping matrices
Hi all,
Are there base functions that do the equivalent of this?
fliptb <- function(x) x[nrow(x):1, ]
fliplr <- function(x) x[, nrow(x):1]
Obviously not hard to implement (although it needs some more checks),
just wondering if it had already been implemented.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
2011 Sep 21
3
Quelplot
Hi all,
Does anyone have an R implementation of the queplot (K.?M. Goldberg
and B.?Iglewicz. Bivariate extensions of the boxplot. Technometrics,
34(3):pp. 307?320, 1992)? I'm struggling with the estimation of the
asymmetry parameters.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
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
2017 Jun 17
3
suggestion to fix packageDescription() for Windows users
Hi Duncan,
Thanks for your reply. Yes, it does seem to be specific to the CTYPE
setting to Chinese on Windows. If I set it to English using
Sys.setlocale() there is no problem, then back to Chinese and the
authors disappear:
Sys.setlocale("LC_ALL","English")
citation("readr")
#' To cite package ?readr? in publications use:
#'
#' Hadley Wickham, Jim
2010 Mar 19
5
Encrypt/decrypt in R
Hi all,
Does any one know of any encryption/decryption algorithms in R? I'm
not looking for anything robust - I want some way of printing output
to the screen that the user can't read immediately, but can decrypt a
little later. The main thing I don't want to the user to see is a
number, so (e.g.) ROT13 isn't appropriate.
Hadley
--
Assistant Professor / Dobelman Family Junior
2017 Jun 17
2
suggestion to fix packageDescription() for Windows users
Recently I was trying to cite a package where the authors have ?
and ? in their names. I found that on Windows the citation() function
did not return the authors' names at all, but on Linux there was no
problem (sessionInfos at the bottom):
On Windows, no author names are returned:
#---------------
> citation("readr")
To cite package ?readr? in publications use:
(2017).
2011 Apr 13
2
Line plots in base graphics
Am I missing something obvious on how to draw multi-line plots in base graphics?
In ggplot2, I can do:
data(Oxboys, package = "nlme")
library(ggplot2)
qplot(age, height, data = Oxboys, geom = "line", group = Subject)
But in base graphics, the best I can come up with is this:
with(Oxboys, plot(age, height, type = "n"))
lapply(split(Oxboys[c("age",
2010 Nov 09
3
How to detect if a vector is FP constant?
Hi all,
What's the equivalent to length(unique(x)) == 1 if want to ignore
small floating point differences? Should I look at diff(range(x)) or
sd(x) or something else? What cut off should I use?
If it helps to be explicit, I'm interested in detecting when a vector
is constant for the purpose of visual display. In other words, if I
rescale x to [0, 1] do I have enough precision to get
2009 Nov 13
3
Escaping regular expressions
Hi all,
Is there a method for escaping strings to be used regular expressions?
i.e. if I have a user supplied string that I'd like to use as a fixed
component is there a method that will turn (e.g.) ".$^" into
"\\.\\$\\^" ?
Thanks,
Hadley
--
http://had.co.nz/
2010 Aug 24
3
require is to suggests as what is to imports?
Hi all,
If a package suggests another package in its description, you can
check it at runtime with requires. How do you do check if a package
is available without loading it, if you only want to access one
function in the package namespace.
Thanks,
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
2011 Jun 29
1
R-devel Digest, Vol 100, Issue 28
I get the same style of path as Hadley. This is on Windows 7 Home Premium with SP1.
I start R by clicking on the R-2.31.0 icon.
I'd assumed that it was a change that came with R-2.13.0!
(On 32-bit Windows XP, which I have just checked, I do indeed get the 8.3 paths.)
> R.home()
[1] "C:/Programs/R/R-2.13.0"
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform:
2009 Nov 08
2
Extracting matched expressions
Hi all,
Is there a tool in base R to extract matched expressions from a
regular expression? i.e. given the regular expression "(.*?) (.*?)
([ehtr]{5})" is there a way to extract the character vector c("one",
"two", "three") from the string "one two three" ?
Thanks,
Hadley
--
http://had.co.nz/
2010 Oct 08
2
What do you call the value that represents a missing argument?
Hi all,
What's the official name for the value that represents a missing argument?
e.g.
formals(plot)$x
str(formals(plot)$x)
deparse(formals(plot)$x)
is.symbol(formals(plot)$x)
What's the correct way to create an object like this? (for example if
you are manipulating the formals of a function to add an argument with
no default value, as in http://stackoverflow.com/questions/3892580/).
2010 Jun 29
4
Tips for debugging: R CMD check examples
Hi all,
Does anyone have any suggestions for debugging the execution of
examples by R CMD check? The examples work fine when I run them from
a live R prompt, but I get errors when they are run by R CMD check.
Thanks,
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
2012 Oct 08
4
Capturing environment associated with a promise
Hi all,
It's possible to capture the expression associated with a promise
(using substitute). Is there any way to capture the environment
associated with a promise? Similarly, is there any way to tell if
something is a promise without accidentally evaluating it?
Thanks!
Hadley
--
RStudio / Rice University
http://had.co.nz/
2011 Aug 16
2
sysdata.rda, namespaces and package dependencies
Hi all,
I'm struggling with accessing a package dataset (munsell.map, stored
in sysdata.rda) when that package is imported, not required. A simple
reproducible example is:
install.packages("munsell")
munsell::mnsl("10B 4/6")
# Error in match(col, munsell.map$name) : object 'munsell.map' not found
library(munsell)
munsell::mnsl("10B 4/6")
# Function