similar to: Persistent storage between package invocations

Displaying 20 results from an estimated 10000 matches similar to: "Persistent storage between package invocations"

2012 Mar 20
1
Substitute adds id attribute?
Hi all, I can't figure out how to make this problem easily reproducible, but I can demonstrate it very simply, so I hoped someone might be able to suggest a place to start: > f <- function(x) substitute(x) > f(x) x > f(mpg) mpg attr(,"id") [1] 11 It works as expected in a clean R session: > f <- function(x) substitute(x) > f(x) x > f(mpg) mpg but not
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
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/
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
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 23
1
Debugging namespace problems
Hi all, I frequently find that I've failed to export something in my NAMESPACE and hence my package doesn't work when it's imported into another package. Does anyone have suggestion for debugging this type of problem? R CMD check passes without any ns related errors on both the importee and the importer. I've attached a reproducible example - if you install the development
2010 Aug 27
2
NEWS and readNEWS
readNEWS() states: Read R's ?NEWS? file or a similarly formatted one. This is an experimental feature, new in R 2.4.0 and may change in several ways and news() also indicates that this tool is supposed to work with non-R news files. However, I've not been able to get readNEWS to read a package news file, even when following the format indicated in news(). Looking at the
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/
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 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 13
3
Detecting development environment
Hi all, Is there a straight-forward, cross-platform way of determining if a user has all the tools needed to develop R packages (i.e. gcc etc)? It doesn't need to be 100%, but should give a rough idea. One idea I had was simply to see if system("R CMD install --help") worked. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University
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 Jun 29
1
Performance enhancement for ave
library(plyr) n<-100000 grp1<-sample(1:750, n, replace=T) grp2<-sample(1:750, n, replace=T) d<-data.frame(x=rnorm(n), y=rnorm(n), grp1=grp1, grp2=grp2) system.time({ d$avx1 <- ave(d$x, list(d$grp1, d$grp2)) d$avy1 <- ave(d$y, list(d$grp1, d$grp2)) }) # user system elapsed # 39.300 0.279 40.809 system.time({ d$avx2 <- ave(d$x, interaction(d$grp1, d$grp2, drop =
2010 Sep 29
1
License of R manuals
Hi all, Under what license are the R manuals (R language definition etc) released? They are not mentioned explicitly in license() and have no license information in the individual documents. Does this mean that they are released under GPL-2? If so, what does that mean, given that they aren't software? Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics
2011 Feb 07
1
Save and serialize
Hi all, Is there any relationship between save and serialize? Do they use the same algorithm? Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2012 Jul 27
1
Version of substitute that evaluates it's first argument
Hi all, Does there already exist a version of substitute that evaluates it's first argument? (i.e. it accepts an already quoted expression). This seems like something that's pretty handy, but I haven't found any existing function to do it: substitute_e <- function(expr, env) { eval(substitute(substitute(expr, env), list(expr = expr))) } f <- quote(x + y + z) substitute(f,
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 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
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/
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