similar to: Behaviour of environment(foo)<- (PR#1509)

Displaying 20 results from an estimated 10000 matches similar to: "Behaviour of environment(foo)<- (PR#1509)"

2001 Jan 09
3
Inconsistent behaviour in solve (PR#805)
I find this a bit puzzling ... > solve(matrix(c(5, 2, 3, 1), 2, 2), c(Inf, 3)) [1] NaN Inf > solve(matrix(c(5, 2, 3, 1), 2, 2)) %*% c(Inf, 3) [,1] [1,] -Inf [2,] Inf I would expect the answer to be c(-Inf, Inf), so why has the -Inf been replaced by NaN in solve? Cheers, Jonathan. --please do not edit the information below-- Version: platform = sparc-sun-solaris2.7 arch = sparc
2001 Aug 14
1
Inconsistent behaviour of is.vector? (PR#1052)
Hi everyone, I have noticed that is.vector returns FALSE if I attach attributes: > x <- c(a = 1, b = 2) > attributes(x) $names [1] "a" "b" > is.vector(x) [1] TRUE > attr(x, "fred") <- "happy" > attributes(x) $names [1] "a" "b" $fred [1] "happy" > is.vector(x) [1] FALSE This seems inconsistent to me,
2000 Apr 06
2
Strange behaviour of image (PR#510)
The following commands z <- matrix(seq(0, 1, len=1000)) image(z, 1, z, zlim=c(0, 1), col=gray(1:10/10)) appear to violate the image functionality as described on the help page. As I understand it, by specifying a zlim of c(0, 1) and a colour vector of length 10, the colours should correspond to the intervals (0, 0.1), (0.1, 0.2), ..., (0.9, 1.0), this being 10 equally-spaced intervals on (0,
1999 Jun 17
1
save.image() (PR#212)
Jonathan Rougier <J.C.Rougier@durham.ac.uk> writes: > Would it be reasonable to suggest adding an `all' flag to save.image(), > i.e. > > "save.image" <- > function (f = ".RData", all.names = F) > eval(substitute(save(list = ls(all.names = all.names), file = f)), > .GlobalEnv) I believe this is simply a bug. I see no reason to skip the
2002 Oct 16
1
Documentation for .Renviron (PR#2175)
Hi everyone, Two minor points about ?.Renviron. 1) If R_ENVIRON is not set then R defaults to `${R_HOME}/etc/Renviron', not `${R_HOME}/etc/Renviron.site' as stated. 2) In the details, there is a missing "way" in "`value' is processed in a similar to a Unix shell." Cheers, Jonathan. --please do not edit the information below-- Version: platform =
2000 Mar 22
3
segmentation fault with 1D array (PR#500)
Here's a nasty one. The following has caused a segmentation fault and possibly also a bus error. fred <- 1:6 dim(fred) <- 6 dimnames(fred) <- list(LETTERS[1:6]) mm <- matrix(1:12, 2, 6) mm %*% fred # segmentation fault here In the case without the dimnames assignment the result is OK. Cheers, Jonathan. --please do not edit the information below-- Version: platform =
2013 Mar 20
1
behaviour of formula objects and environment inside functions
Dear List I am looking for the recommended way to create a formula inside a function with an empty environment. I tried several versions (see below), and one of them seemed to work, but I dont understand why there is a difference between .GlobalEnv and the environment inside a function. I would be greatful for any reference or explanation or advice. Thanks Thomas #+BEGIN_SRC R :results output
2002 Oct 07
2
Core dump with "parse" (PR#2120)
Hi everyone, The following code may not be very sensible, but it generates a core dump. The same happens in R-1.5.1. Cheers, Jonathan. arrow:dma0jcr% R-1.6.0 R : Copyright 2002, The R Development Core Team Version 1.6.0 (2002-10-01) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type `license()' or `licence()'
2002 Nov 19
1
Nesting of readline input (PR#2310)
Hi everyone, I am following instructions here as I have generated the following warning: > # stuff looping through some plots with ask=TRUE Hit <Return> to see next plot: Hit <Return> to see next plot: Hit <Return> to see next plot: Hit <Return> to see next plot: Hit <Return> to see next plot: In addition: Warning message: An unusual circumstance has arisen
2009 Jan 05
2
eval using a environment X but resultsin .GlobalEnv
Hello, Suppose I have an expression, E, which accesses some variables present in an environment V. I do this via eval(E,envir=V) however all assignments end up in V. I would like the results of assignments in E to end up in the .GlobalEnv ? Or at least the calling environment. Is there a quick way to this instead of iterating over all objects E and assigning into .GlobalEnv? Thank you Saptarshi
2016 Jul 27
3
Model object, when generated in a function, saves entire environment when saved
In the below, I generate a model from an environment that isn't .GlobalEnv with a large object that is unrelated to the model generation. It seems to save the irrelevant object unnecessarily. In my actual use case, I am running and saving many models in a loop that each use a single large data.frame (that gets collapsed into a small data.frame for estimation), so removing it isn't an
2016 Jul 27
2
Model object, when generated in a function, saves entire environment when saved
Another solution is to only save the parts of the model object that interest you. As long as they don't include the formula (which is what drags along the environment it was created in), you will save space. E.g., tfun2 <- function(subset) { junk <- 1:1e6 list(subset=subset, lm(Sepal.Length ~ Sepal.Width, data=iris, subset=subset)$coef) } saveSize(tfun2(1:4)) #[1] 152 Bill
2001 Mar 29
1
Detaching "ctest"
Hi Everyone, We have just upgraded to R-1.2.1, and I note, in contrast to R-1.1.1, that ctest is now loaded automatically. The mechanism for this is to create a .First function in base: .First <- function() { require("ctest", quietly=TRUE) } Now I don't want ctest, but I find that simply putting if (length(grep("ctest", search()))) detach(package:ctest) into
2001 Apr 30
1
Segmentation fault linked to memory? (PR#929)
Hi Everyone, The following rather extreme claim on memory causes a segmentation fault on my installation: fred <- matrix(1:1200, 20, 60) littleOP <- function(x, y) { z <- as.vector(x) %*% t(as.vector(y)) dim(z) <- c(dim(x), dim(y)) z } littleOP(fred, fred) # this is OK littleOP(littleOP(fred, fred), fred) # whoops! Segmentation fault What's a bit strange
2001 Apr 10
1
Segmentation fault in subscripting array of lists (PR#904)
I get a segmentation fault as follows: > tmp <- array(list(), c(3, 4)) > tmp[[1, 2]] NULL # as expected > tmp[[1, 2]]$fred <- 1:10 > tmp # as expected [,1] [,2] [,3] [,4] [1,] "NULL" "List,1" "NULL" "NULL" [2,] "NULL" "NULL"
2014 May 17
1
environment question
According to :https://stat.ethz.ch/R-manual/R-devel/library/base/html/environment.html "If |fun| is a function or a formula then |environment(fun)| returns the environment associated with that function or formula. If |fun| is |NULL| then the current evaluation environment is returned." > environment() <environment: R_GlobalEnv> > environment(environment)
2002 Mar 08
2
Sys.putenv environment variables disappear (PR#1371)
Environment variables set with Sys.putenv() disappear (i.e. become "") after a while, especially after heavy-duty I/O. Example: R> x <- matrix(1., 3000, 3000) R> save(x, file="myx.RData") R> Sys.putenv(HOME="/tmp") R> while (Sys.getenv("HOME") != "") {cat("ok\n"); load("myx.RData")} The loop prints
2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
The behaviour of within() with list input changes if you delete 2 or more variables, compared to deleting one: l <- list(x=1, y=2, z=3) within(l, { rm(z) }) #$x #[1] 1 # #$y #[1] 2 within(l, { rm(y) rm(z) }) #$x #[1] 1 # #$y #NULL # #$z #NULL When 2 or more variables are deleted, the list entries are instead set to NULL. Is this intended?
2000 May 19
7
variance of a scalar (PR#546)
I was surprised to find that the variance of a scalar, using var(), is NA. Surely this should be zero? Cheers, Jonathan. --please do not edit the information below-- Version: platform = sparc-sun-solaris2.7 arch = sparc os = solaris2.7 system = sparc, solaris2.7 status = Patched major = 0 minor = 99.0 year = 2000 month = February day = 9 language = R Search Path: .GlobalEnv,
2017 Dec 02
2
source files in temp environment
Hi all, I often keep code in separate files for organizational purposes, and source() that code from higher level scripts. One problem is that those sourced files often create temporary variables that I don't want to keep around. I could clean up after myself with lots of rm()'s, but that's a pain, and is messy. I'm wondering if one solution might be to source the code in a